1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<div id="editor">
<p>Whatever</p>
</div>
<script>
CKEDITOR.replace( 'editor', {
toolbar: [ [ 'toggleButton' ] ],
on: {
pluginsLoaded: function( evt ) {
evt.editor.addCommand( 'toggleButton', {
exec: function() {
if ( this.state === CKEDITOR.TRISTATE_OFF ) {
this.setState( CKEDITOR.TRISTATE_ON );
} else {
this.setState( CKEDITOR.TRISTATE_OFF );
}
}
} );
evt.editor.ui.addButton( 'toggleButton', {
label: 'Sample button',
icon: 'Link',
isToggle: true,
command: 'toggleButton'
} );
}
}
} );
</script>
|