plugin.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. CKEDITOR.plugins.add( 'chain', {
  2. requires: 'dialog,fakeobjects',
  3. icons: 'chain',
  4. init: function( editor ) {
  5. editor.addCommand( 'chain', new CKEDITOR.dialogCommand( 'chainDialog' ) );
  6. editor.ui.addButton( 'chain', {
  7. label: 'Âñòàâèòü òðàíñëÿöèþ',
  8. command: 'chain',
  9. toolbar: 'insert',
  10. icon : this.path + 'icons/chain.png'
  11. });
  12. if ( editor.contextMenu ) {
  13. // alert(this.path + 'icons/polls.png');
  14. // editor.addMenuGroup( 'pollGroup' );
  15. editor.addMenuItem( 'chainItem', {
  16. label: 'Ðåäàêòèðîâàòü òðàíñëÿöèþ ',
  17. icon: this.path + 'icons/chain.png',
  18. command: 'chain',
  19. group: 'others'
  20. });
  21. editor.on( 'doubleclick', function( evt ) {
  22. var element = evt.data.element;
  23. if ( $(element).attr('id') == 'widgetchain' )
  24. evt.data.dialog = 'chainDialog';
  25. } );
  26. editor.contextMenu.addListener( function( element ) {
  27. if ( element.getAscendant( 'chain', true ) ) {
  28. return { pollsItem: CKEDITOR.TRISTATE_OFF };
  29. }
  30. });
  31. }
  32. CKEDITOR.dialog.add( 'chainDialog', this.path + 'dialogs/chain.js' );
  33. }
  34. });