plugin.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. CKEDITOR.plugins.add( 'gallery', {
  2. icons: 'gallery',
  3. init: function( editor ) {
  4. editor.addCommand( 'gallery', new CKEDITOR.dialogCommand( 'galleryDialog' ) );
  5. editor.ui.addButton( 'Gallery', {
  6. label: 'Вставьте галерею',
  7. command: 'gallery',
  8. toolbar: 'insert'
  9. });
  10. if ( editor.contextMenu ) {
  11. editor.addMenuGroup( 'galleryGroup' );
  12. editor.addMenuItem( 'galleryItem', {
  13. label: 'Редактировать галерею ',
  14. icon: this.path + 'icons/gallery.png',
  15. command: 'gallery',
  16. group: 'galleryGroup'
  17. });
  18. editor.on( 'doubleclick', function( evt ) {
  19. var element = evt.data.element;
  20. if ( $(element).attr('id') == 'widgetgallery' )
  21. evt.data.dialog = 'galleryDialog';
  22. } );
  23. editor.contextMenu.addListener( function( element ) {
  24. if ( element.getAscendant( 'gallery', true ) ) {
  25. return { galleryItem: CKEDITOR.TRISTATE_OFF };
  26. }
  27. });
  28. }
  29. CKEDITOR.dialog.add( 'galleryDialog', this.path + 'dialogs/gallery.js' );
  30. }
  31. });