plugin.js 1.1 KB

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