0
votes

So, I have a page with div's that have contenteditable=true, and I load //cdn.ckeditor.com/4.7.3/standard/ckeditor.js which makes them editable with CKEditor - but since I do not use CKEDITOR.replace() I can't send along a configuration for the editor's. How do I set the toolbar configuration for CKEditor that is being loaded for contenteditable fields?

2

2 Answers

0
votes

If you want to use CDN, I'm afraid only option is to use

CKEDITOR.disableAutoInline = true;
CKEDITOR.inline("div_id", { customConfig: "config.js" });
0
votes

Inline editor

If you wish to have inline editor, you can use CKEDITOR.inline method to converse such div into inline editor, you can pass regular configuration as object in second argument. Example with configuration which change ui colour you can do like that (full example):

var editor = CKEDITOR.inline( 'editor', {
  uiColor: '66FFFF'
} );

Divarea editor

Another option is to use divarea editor. In such case you use regular CKEDITOR.replace method and you have to add divarea plugin. Example implementation below with link to codepen implementation. https://codepen.io/msamsel/pen/YEbode As you can see css from main website are also applied inside the editor.

var editor = CKEDITOR.replace( 'editor', {
  uiColor: '66FFFF',
  extraPlugins: 'divarea'
} );