Problem/Motivation
Currently, Drupal 8 includes only a build version of CKEditor. This makes it hard to:
- Test a completely different version of CKEditor (e.g. some patch, new beta release, etc.). Switching between versions should be painless.
- Debug some issues (because the build version is concatenated and minified).
Proposed resolution
Ideally, Drupal repo should not include a build of CKEditor, but a submodule with https://github.com/ckeditor/ckeditor-dev (dev version of CKEditor). When going on a production, a CKEditor package would be build to optimise the loading speed.
I guess though, that it's too complicated. So a partial solution would be to keep a build of CKEditor just like now, but allow to switch to other version of CKEditor with a single flag/option (for example - specifying the path where that CKEditor repo is kept).
Provide instructions on how to do a few simple manual steps to swap out Drupal's optimized (minified) build of CKEditor for an unminified one.
Remaining tasks
Review.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#13 | cke_dev-2480333-13.patch | 1.13 KB | Wim Leers |
#8 | Selection_331.png | 257.7 KB | Elijah Lynn |
Comments
Comment #1
Reinmar CreditAttribution: Reinmar commentedComment #2
Wim LeersTotally agreed for long-term maintenance and development of CKEditor plugins against D8.
But, preferably, we'd do this later, possibly during the RC phase. So: how urgent is this?
Comment #3
Reinmar CreditAttribution: Reinmar commentedNothing critical. As you said - for a long-term maintenance.
Comment #4
Wim LeersAlright, cool :)
Comment #5
nod_Git Submodules are a no-go, what we could talk about is something like npm or bow
ser to handle our third party frontend assets.Those sound like features for a ckeditor module, overriding libs and all. Module which could possibly declaring another CKEditor editor through the editor API that way it could have it's own configuration set of modules and all. May be a bit of work to create but that would be the clean way to go.
As far as core is concerned I think what we might talk about is some kind of version compatibility for ckeditor plugins. For the minified version, can sourcemap help or not? We do support those in core now.
Comment #6
Elijah LynnFrom my duplicate issue here #2492339: How to debug CKEditor in core?.
I will note that the CTO of CKSource -> CKEditor, Wiktor Walc (wwalc), says that using source maps seems to be difficult because:
source: https://github.com/ckeditor/ckeditor-releases/issues/11#issuecomment-468...
Comment #7
Wim LeersI worked on this a bit, but got stuck on debugging CKEditor's loading process to figure out where it's going wrong. Pinged the CKEditor guys for feedback.
Comment #8
Elijah LynnOkay, so I think I have the rough and tough type of approach for D8 based on a bunch of stuff for Drupal 7's Wysiwyg + CKEditor integration I just figured out. It appears to work so far with no related console errors including not getting the image2 error. Here are the steps so far:
more discussion:
https://github.com/ckeditor/ckeditor-releases/issues/11#issuecomment-682...
http://stackoverflow.com/questions/22354231/ckbuilder-gives-me-too-many-...
Comment #9
Wim LeersComment #10
Reinmar CreditAttribution: Reinmar commentedSmall clarification – when I wrote "all" I didn't mean "all" :D. CKEditor resolves plugin dependencies, so e.g. if you enable the image plugin then CKEditor will automatically load the dialog plugin which will cause loading the dialogui plugin. So what you have to specify are the end-plugins. And don't forget about the wysiwygarea plugin which isn't required by any other plugin because it can be replaced e.g. with divarea, but it's required if you want to create the classic, iframed editor.
Comment #11
Wim LeersRight.
And I forgot to paste an important bit from our conversation:
Comment #12
Wim LeersI've done some more debugging. AFAICT the only reason the method I proposed in #9 is currently failing, is the fact that Drupal's CKE plugins extend certain things in a way that assumes certain code has already loaded. Which is true in the case of Drupal's included CKEditor build, because everything is compiled into it. But it's no longer the case when CKEditor loads everything dynamically.
I attempted to fix that, and CKEditor now is able to instantiate an instance without any errors! :)
… but it does not show up :(
STR:
git clone http://git.drupal.org/project/drupal.git /www/drupal
git clone https://github.com/ckeditor/ckeditor-dev.git ~/ckeditor; git checkout 4.5.3
cd drupal
wget https://www.drupal.org/files/issues/cke_dev-2480333-12.patch
git apply -3v cke_dev-2480333-12.patch
mv core/assets/vendor/ckeditor core/assets/vendor/ckeditor-original
ln -s ~/ckeditor core/assets/vendor/ckeditor
/node/add/article
Comment #13
Wim LeersGiven #12, I think it makes sense to at least for now go with the excellent proposal from Elijah Lynn in #8. I think not having to first create an unminified build would be even better, but for now (and given we're so close to RC), this seems like a very workable solution.
Since this touches only code docs, this is RC eligible.
Committers, please credit Elijah Lynn!
Comment #14
nod_Looks good to me.
Comment #15
nod_I ended up having to use the uminified release of ckeditor today, this documentation did the trick.
Comment #16
alexpottCommitted 0a05169 and pushed to 8.0.x. Thanks!
Comment #19
ashopin CreditAttribution: ashopin commentedI've tried the /builder method several times this morning with no luck:
Am I missing anything?
Comment #20
Elijah Lynn@ashopin - You may want to try the build.sh route, #2 below.
Comment #21
francescjr CreditAttribution: francescjr commentedFor the "build.sh route, #2 below", I had to do all this:
Then, replace this directory (core/assets/vendor/ckeditor) with your build:
In case it helps anybody.
Comment #22
bkosborneWhere is the "build.sh" file? I searched all files in Drupal for this filename and also the ckeditor "big and slow" download and it's not in any of these.
I'm also having trouble with this as you can see :)
I tried just uploading the build-config.js and swapping that with the ckeditor directory shipped with core, but I just get a couple of JS errors when loading a page that uses CKEditor, including the config page.
Comment #23
Elijah Lynn@bkosborne, you need to clone the ckeditor dev code. Take a look at #12.
Comment #24
bkosborneWell I'm back again 3 years later!
The instructions in the ckeditor build file say this currently:
I followed the first option and I the editor does not load. I get JS error "TypeError: CKEDITOR.skinName is undefined".
Since this issue is quite old I suppose I will open a new one.
Comment #25
bkosborneI created #3070880: One of methods documented by Drupal core to create a CKEditor build does not work anymore: update docs