Skip to content

Instantly share code, notes, and snippets.

@igotit-anything
Last active August 27, 2016 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igotit-anything/e5edef3764c2023da48fc9893c38063d to your computer and use it in GitHub Desktop.
Save igotit-anything/e5edef3764c2023da48fc9893c38063d to your computer and use it in GitHub Desktop.
JavaScript. CKEditor plugin Dialog basic code. - example: Cy-GistInsert's dialogs/Cy-GistInsertDlg.js
/*
file name : Cy-GistInsertDlg.js
CKEditor Plugin "Cy-GistInsert" Dialog
by igotit. 2016-08-28.
*/
CKEDITOR.dialog.add('Cy-GistInsertDlg', function (editor) {
return {
title: 'Cy-GistInsert', // text shown titlebar.
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'tab-basic',
label: 'Basic Settings',
elements: [
// UI elements of the first tab should be defined here.
{
type: 'text',
id: 'id-gisturi',
label: 'GitHub Gist ID',
validate: CKEDITOR.dialog.validate.notEmpty("GitHub Gist ID field cannot be empty.")
}
]
},
{
id: 'tab-adv',
label: 'Advanced Settings',
elements: [
// UI elements of the second tab will be defined here.
{
type: 'text',
id: 'id-dummy',
label: 'title',
}
]
}
],
onOk: function () {
var dialog = this;
editor.insertHtml('Test from plugin Cy-GistInsert Dialog text = ' + dialog.getValueOf('tab-basic', 'id-gisturi')); // at now just testing purpose.
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment