How to set the some default CKEditor styles(Presented in Styles combo box) at the current position through javascript.?
For example if the cursor in one position, i have to set the ‘Marker: Yellow’ style for that position after typing any character it should change to Yellow. Is it Possible?
I’m not sure if I understood you, but isn’t you just want to exec command applying (or removing) e.g. bold style? If yes you can do this by:
If you’ve got empty selection (caret) placed somewhere in the text, before executing this command, editor will create empty
<strong>^</strong>element, so when user starts to type, the text will be bolded.Update
Styles are applied in a little bit different way.
That will apply Blue Title style to the current selection. You can find other styles definitions in
_source/plugins/styles/styles/default.js(http://dev.ckeditor.com/browser/CKEditor/trunk/_source/plugins/styles/styles/default.js) or you can get them in the code: