When I need to edit existing text stored in the database, some buttons on the CKeditor toolbar are pressed as they already have some styles.
For instance, if I have the following text in my database:
<strong>asdf</strong>
when I edit this text, the "bold" button is pressed.
I need to set bulletedlist
clicked as the default setting of my editor. I listen to the instanceReady
event and use execCommand('bulletedlist')
when the event is on to achieve my goal:
CKEDITOR.on( 'instanceReady',function(ev) {
ev.editor.execCommand( 'bulletedlist' );
} );
however, if the text is already bulleted, calling execCommand('bulletedlist')
will cancel the bulleted style.
I need to know which buttons are pressed when users start editing the text, so I can prevent canceling the default style. How can I achieve this?