Reputation: 2012
I'm trying to use CKEditor simply as an API that I can drive with my own UI.
Firstly, is this the right use of CKEditor?
If so, how could I modify the font size of a text selection programmatically?
Upvotes: 0
Views: 1421
Reputation: 3401
It's a doable approach, but for some cases it might be tough and require some code duplication.
There are older parts of CKE that encapsulate many useful things, so you have no convenient API to access it from outside.
The minimal effort would be to simply use CKEDITOR.style objects.
var editor = CKEDITOR.instances.editor1;
var style = new CKEDITOR.style( {
element: 'span',
styles: { 'font-size': '20px' }
} );
editor.applyStyle( style );
For more examples see font plugin, you're interested in fontSize combobox.
Upvotes: 2