How do you get CKEditor 5 to work with Datatables?
How do you get CKEditor 5 to work with Datatables?
Datatables 1.10
Description of problem:
Thanks to the plugin for ckeditor 4 we got that working. Now we're moving up to CK5. I found the plugin:
https://editor.datatables.net/plug-ins/field-type/editor.ckeditor5#Javascript
Downloaded it and uploaded to my server (renamed it to reduce confusion but no other change. I added it as an external javascript file along with the ck5 file:
<script src='ckeditor5/datatables+ckeditor5.js'></script>
<script type='text/javascript' src='ckeditor5/build/ckeditor.js' comment='ckeditor 5'></script>
In the html I change the textarea from ckeditor (for ckeditor4) to ckeditorClassic:
{
label: 'Answer/Info:',
type: 'ckeditorClassic',
id: 'textarea',
name: 'faq.answer'
}
However when the page loads it loads a blank table.

Can you give us any pointers on why it's failing?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you seeing any console errors in the browser? And are you able to link to your page so we can take a look?
Colin
My developer said the error he sees is:
``ckType undefined
I set up a demo on my devel server:
https://www.dottedi.xyz/demo/bin/faq2.phpIf you wish to compare with the ckeditor 4 version see:
https://www.dottedi.xyz/demo/bin/faq.phpLooks like the initialization is failing at this line in the plugin code:
Its looking for
ClassicEditorinwindowbut its not there. Which is causingckTypeto be undefined causing thejquery-3.3.1.js:3827 Uncaught TypeError: Cannot read property 'create' of undefinedin this line:ckType.create( conf._input[0], conf.opts )I suspect the problem is you are loading the plugin before CKEditor. Try reversing these tow lines:
Kevin
Reversing the sequence gets the table to load however the Answer field which should load the editor only loads as simple input field.
I checked for errors and the undefined error is gone but I see these two:
I cleared cache.
This one can safely be ignored - it is a CSS warning. DataTables Core still supports IE6 (at least for now), so there are a few hacks in the stylesheet, such as that.
Are you using
$.ajaxwithasync: falsesomewhere on your page? DataTables doesn't do that by default, so it must be coming from somewhere else.Allan
Aside from the ajax line in the html file , not that I know of.
<
script type="text/javascript" language="javascript" class="init">
var editor;
Thanks! And sorry I missed the links to your page above. The console message says:
So its coming from CKEditor. You'd need to check with their support team to see what can be done about it.
Allan
I passed this thread along to my contractor - I'm not sure what he did but he was able to get CKE5 working within DataTables without consulting CKE support/forum.
CK5 has a lot of advantages in general over CK4 however some learning curve and some gotchas we haven't solved yet. For instance outside of DataTables there is a sticky (fixed) toolbar function - great for long pages. Within DT it doesn't work off the shelf.