I've been doing my best to try to make the dev version of v5 (the code in ckeditor5
) in a way that it works out of the box in websites using CKEditor,in the very same way the build version would work. Essentially, we're talking about having the CKEDITOR
namespace exposed and ready to be used.
The problem is that the CKEDITOR
namespace is made by code present in several files in ckeditor5-core
which need to be downloaded before the namespace gets ready. So, to do it, we limited the number of features in CKEDITOR
on startup, extending it asynchronously while loading core.
Now I'm working on #3, to introduce CKEDITOR.create()
. Here again, we would have to have a fake create()
function that would just save the creation call to be really executed just later, when core is loaded. We do this in v4 and it "works", but it's a mess and the code is dirty.
To make it worst, we would like create()
to return a Promise
, which is a class from core. So, if core is not available, we would have to return something the looks like a promise and so on... more dirty and unclear code.
Therefore, I think we're going to the wrong direction.
In short, we're not able to make the CKEDITOR
namespace work right with the dev version, so we should make it AMD only.
In any case, we require RequireJS to run dev code. So we'll always have AMD in place.
This means that, when using the dev code, one should always do something like the following:
require( [ 'ckeditor' ], function( CKEDITOR ) {
CKEDITOR.create( ... );
} );
Then, the build version will offer the CKEDITOR
namespace as well, but we'll not have it in the dev version.
I need a confirmation for this so I can work on this change.