Good day. Can you please tell me how in Ckeditor 4.5.x to do the opposite action by pressing the same button? For example, as it happens when you press the B
(bold) button.
An example of code that inserts the tag ... in the selected text:
var PlugName = 'norss'; var PlugDesc = 'Исключить из RSS'; CKEDITOR.plugins.add( PlugName, { icons: PlugName, init: function( editor ) { if ( editor.ui.addButton ) { editor.ui.addButton( PlugName, { label: PlugDesc, command: PlugName, toolbar: 'insert' } ); } editor.addCommand( PlugName, { exec: function( editor ) { var sel = CKEDITOR.dom.element.createFromHtml( '<span class="no_rss">' + editor.getSelectedHtml(true) + '</span>' ); editor.insertElement( sel ); } }); }, } );
It is necessary that the button be displayed as pressed when hovering / highlighting the code that is inside it, and when this button is “unwrapped”, this tag is removed.