Set Default Element in CKEditor -
i have custom style set called 'paragraph', (obviously) creates p
element user enter text into.
when first entering ckeditor area, no style set , user entering text inside no specific element. eg location bar @ bottom reads body
is there way can make editor default having p element when user first enters editor area, in body > p
?
i've spent while checking documentation, , can see how set default font , font size, isn't want.
edit here styles.js file have customised provide styles:
ckeditor.stylesset.add( 'default', [ /* block styles */ // these styles available in "format" combo ("format" plugin), // not needed here default. may enable them avoid // placing "format" combo in toolbar, maintaining same features. { name: 'paragraph', element: 'p' }, { name: 'heading 1', element: 'h1' }, { name: 'heading 2', element: 'h2' }, { name: 'heading 3', element: 'h3' }, { name: 'heading 4', element: 'h4' }, { name: 'heading 5', element: 'h5' }, { name: 'heading 6', element: 'h6' } ]);
and here config.js file
ckeditor.editorconfig = function (config) { // disable ckeditor acf config.allowedcontent = true; config.uicolor = '#ffffff'; config.dialog_backgroundcovercolor = '#888888'; config.skin = 'moono'; config.entermode = ckeditor.enter_br; config.shiftentermode = ckeditor.enter_p; config.entities_latin = false; config.protectedsource.push(/<script[\s\s]*?<\/script>/gi); // <script> tags. config.toolbar_full = config.toolbar_default = [ ['source', '-'], ['cut', 'copy', 'paste', 'pastetext', 'pastefromword', 'spellchecker', 'scayt', '-'], ['undo', 'redo', 'find', 'replace', 'removeformat', '-'], //['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', '-'], //['numberedlist', 'bulletedlist', 'outdent', 'indent', 'blockquote','creatediv', '-'], ['numberedlist', 'bulletedlist', 'outdent', 'creatediv', 'blockquote', '-'], //['justifyleft', 'justifycenter', 'justifyright', 'justifyblock', '-'], ['insertlink', 'unlink', 'anchor', '-'], //['insertimageormedia', 'quicklyinsertimage', 'table', 'horizontalrule', 'specialchar', '-'], ['insertimageormedia', 'table', 'specialchar', '-'], //['insertforms', 'insertpolls', 'insertrating', 'insertyoutubevideo', 'insertwidget', '-'], ['insertforms', 'insertyoutubevideo', 'insertwidget', '-'], //['styles', 'format', 'font', 'fontsize'], ['styles', '-'], //['textcolor', 'bgcolor', '-'], //['insertmacro', '-'], ['maximize', 'showblocks'] ]; config.toolbar = config.toolbar_full; config.scayt_customerid = '***';};
and here screenshot of happens on first entering area:
it looks culprit in case config.entermode = ckeditor.enter_br;
the workaround here insert <p></p>
default contents of editor it's not empty when it's initialized or cleared. cursor should automatically plop inside paragraph.
Comments
Post a Comment