CKEDITOR.plugins.add('tirusgallery', { icons: 'gallery', init: function(editor) { editor.addCommand('tirusgalleryDialog', new CKEDITOR.dialogCommand('tirusgalleryDialog')); editor.ui.addButton('Tirusgallery', { label: 'Insert gallery', command: 'tirusgalleryDialog', toolbar: 'insert' }); } }); CKEDITOR.dialog.add('tirusgalleryDialog', function(editor) { return { title: 'Galleries', minWidth: 400, minHeight: 100, contents: [ { id: 'tab-basic', label: 'Choose your gallery', elements: [ { type: 'text', id: 'category', label: 'Category', validate: CKEDITOR.dialog.validate.notEmpty("You must select category") }, { type: 'text', id: 'album', label: 'Album', validate: CKEDITOR.dialog.validate.notEmpty("Select album, which you want to add") } ] } ], onOk: function() { var dialog = this; var abbr = editor.document.createElement('gallery'); //abbr.setAttribute('title', dialog.getValueOf('tab-basic', 'title')); abbr.setText('[*]albumList,'+dialog.getValueOf('tab-basic', 'album')+'[/*]'); editor.insertElement(abbr); } }; });