CKEDITOR.plugins.add( 'gallery', { icons: 'gallery', init: function( editor ) { editor.addCommand( 'gallery', new CKEDITOR.dialogCommand( 'galleryDialog' ) ); editor.ui.addButton( 'Gallery', { label: 'Вставьте галерею', command: 'gallery', toolbar: 'insert' }); if ( editor.contextMenu ) { editor.addMenuGroup( 'galleryGroup' ); editor.addMenuItem( 'galleryItem', { label: 'Редактировать галерею ', icon: this.path + 'icons/gallery.png', command: 'gallery', group: 'galleryGroup' }); editor.on( 'doubleclick', function( evt ) { var element = evt.data.element; if ( $(element).attr('id') == 'widgetgallery' ) evt.data.dialog = 'galleryDialog'; } ); editor.contextMenu.addListener( function( element ) { if ( element.getAscendant( 'gallery', true ) ) { return { galleryItem: CKEDITOR.TRISTATE_OFF }; } }); } CKEDITOR.dialog.add( 'galleryDialog', this.path + 'dialogs/gallery.js' ); } });