Hi, I'm learning how to write a plugin for CK Editor.
In the plugin I'm writing, I'm embedding HTML in the editor. However, I need to allow the styles for the HTML to apply within the editor itself, but I can't find anything that provides a proper explanation of how I accomplish this.
Of the examples I have found, they're either just partial explanations that point to cryptic lumps of code in the documentation that have zero context and zero examples, or they're specific to including styles on drop-down menu, which isn't what I'm doing.
Any advice would a be help, thanks.
Is this guide any help to you
Is this guide any help to you?
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Hi Anna, that's a perfect
Hi Anna, that's a perfect example (which I found earlier) of what I'm refering to when I talk about zero context and / or examples; what am I supposed to do with editor.addContentsCss(), and where does it go in the context of a plugin?
I've spent over an hour trying that code out in different places in the code, to no avail.
I can't find anything here in the forums, in your documentation, or on the web.
Guessing game
Having used brute force guessing (going through some 70+ combinations everywhere within the "plugin.js" file, I've found that:
CKEDITOR.config.contentsCss = this.path + 'styles/comment.css';
... works when placed after:
CKEDITOR.dialog.add( 'commentDialog', this.path + 'dialogs/comment.js' );
... but only when prepended with "CKEDITOR." which wasn't suggested, or made obvious, but instead assumed.
What would be an enormous help to developers — because I know from the comments I'm not alone here — would be some tutorials and how-to guides that don't make assumptions and provide real-world examples, rather than just the one.
Hi Wayne,
Hi Wayne,
sorry to hear that the existing docs do not serve their purpose for you, we'll try to improve that - I'll keep this issue on my TODO list :-) We're now working on the brand new CKEditor SDK which will include dozens of samples with well-accessible source code, ready to copy and use in your own solution, with CKEditor features documentation to complement that - hopefully this should improve the situation a bit.
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Hi, having tried the example:
Hi, having tried the example:
CKEDITOR.config.contentsCss = this.path + 'styles/comment.css';
... it's overriding the styles of the editor itself, which is not what I need.
Also, because CKEditor has the habit of refusing to update its cache, I cannot do any additional development, because I can't see any of the changes I'm making.
I need to append the core editor style sheet, not replace it.
Is there a means of doing this?