Problem/Motivation
#1894644: Unidirectional editor configuration -> filter settings syncing ensured that changing the Text Editor's configuration caused filter settings to update also.
#2039163: Update CKEditor library to 4.4 broke that for CKEditor's image plugin.
Proposed resolution
The root cause is the assumption that Drupal (well, I) made: that button names are always identical to command names. This used to be the case at the time, but doesn't hold up, as this regression proves.
Therefore the solution is simple: track which buttons map to which features ("features" ~= "commands").
Remaining tasks
Review.
User interface changes
None, except that things start working again :)
API changes
None.
Data model changes
None.
Original report
I did a fresh install of Drupal 8.0.0-beta11. I enabled the Restricted HTML for both the administrator (unlike basic and full it was disabled by default) and for a new "Writer" role. In the CKEditor confguration the media button is in the toolbar for the Restricted HTML format as well as for the Basic HTML format.
Upon creating a new Article (both as Writer user or as Administrator) the format is set to basic and the media button is displayed in the CKEditor toolbar (the little image icon). However, upon switching to the Restricted HTML format the toolbar changes to reflect the set-up of the Restricted HTML format but the image icon goes missing.
Is there something I overlooked? I can't find any permissions that would affect this and I would expect this issue not to show up for the administrator user.
There are no javascript errors displayed in the console. Nor are there any drupal errors in the recent log messages.
Comment | File | Size | Author |
---|---|---|---|
#9 | ckeditor_setting_syncing-2510138-9.patch | 4.27 KB | Wim Leers |
Comments
Comment #1
Wim LeersWhich is this "Media" button? Is that a contrib module?
Comment #2
KingdutchIt's the button that has href="javascript:void("Image")". Renamed the title to match this.
The only contrib module I have installed is Google Analytics. However, I installed this module well after creating this issue.
I attached two screenshots. One displaying the toolbar with button (Text format Full HTML) and one with the button missing (Text format Restricted HTML). It's to the right of the Blockquote button (it should be anyway).
Comment #3
Wim LeersPlease see https://vimeo.com/62160137 — note how the list of allowed HTML tags is being updated when you add new buttons. That should've happened for you as well.Reproduced. This is what should happen: https://vimeo.com/67687240 … but it does not. The image button is enabled for the Restricted HTML format if you enable CKEditor, but it should remain disabled.
So this broke somehow somewhere along the way :( I'm betting it's one of the Backbone updates.
@Kingdutch: Thanks for your great bug report :) You can fix it by adding
<img>
to the list of allowed HTML tags, which you can find at the bottom of what you called the CKEditor configuration page.Comment #4
droplet CreditAttribution: droplet commented3 problems
- both drop & drag do not sync.
- drupalimage doesn't match correct command ?
editor.addCommand('editdrupalimage', {
- bad split tag function ( fixed in my patch )
Comment #5
Wim Leers@reinmarpl — CKEditor developer — broke Drupal's automatic updating of text filter configuration in #2039163-32: Update CKEditor library to 4.4 — by changing the command from
drupalimage
toimage
. Drupal's JS that is able to do this automatic updating assumed that feature names == button names. But that's no longer true as of that moment. And apparently it was a wrong assumption all along.This again shows why we very much need automated JS tests! :(
Comment #6
Wim LeersThis change fixes another bug: the fact that stylescombo's settings changes do not cause the allowed HTML tags to update as expected, because its event listener is created too early. This ensures it runs at the right time.
This is also strictly speaking not fixing a bug here, but helps fix another issue: [LINK WILL FOLLOW].
This really is just making things consistent with the
drupalimage
plugin, which does correctly specify the exclamation points for these required attributes.i.e. this ensures that CKEditor knows these attributes are required.
All other changes are directly there to fix the reported bug. The other changes are so small and are also in the area of "make setting syncing work again", so I figured I'd include them here.
Comment #7
Wim Leers#2549077: Allow the "Limit allowed HTML tags" filter to also restrict HTML attributes, and only allow a small whitelist of attributes by default is also blocked on this.
Comment #8
nod_Following doesn't work?
Otherwise, no problem with it.
Comment #9
Wim LeersOops, yes, of course. Manually tested, this also works, as one would expect since the code is equivalent :)
Comment #10
nod_All good
Comment #11
Dave ReidI'm assuming this will affect Entity Embed and URL Embed? I tried testing this and it's not adding drupal-entity to the list of allowed HTML tags for us.
Comment #12
Wim Leers#11: It'd only affect it:
This cannot ever adversely affect those modules.
If it's not yet working for Entity Embed/URL Embed, then it probably means their CKEditor plugins don't have the necessary metadata set yet. I'm happy to help you fix that.
Comment #13
alexpottCommitted f1a0e7c and pushed to 8.0.x. Thanks!