Follow-up to #2579979: Allow contrib to alter EditorImageDialog/EditorImageDialog and have custom attributes be stored
Problem/Motivation
I'm getting strange JS errors after this:
Uncaught TypeError: Cannot set property 'float' of undefined
Looks like styles is not initialized, but I have no idea what's different in my case that it only happens for me?
This for example happens when switching from an text format without drupalimage to one that has it enabled and completely breaks wysiwyg then.
The following fixes it for me, I can open a follow-up tomorrow, but I don't know enough JS to know if the problem is really somewhere else?
diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js index 724fa50..5160797 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -43,6 +43,7 @@ }); var allowedContentDefinition = { element: 'img', + styles: { }, attributes: { '!data-entity-type': '', '!data-entity-uuid': ''
Proposed resolution
Fix it.
Remaining tasks
Write patch & review
User interface changes
None
API changes
None
Related Issues
#2061377: [drupalImage] Optionally apply image style to images uploaded in CKEditor 5
#2579979: Allow contrib to alter EditorImageDialog/EditorImageDialog and have custom attributes be stored
Comment | File | Size | Author |
---|---|---|---|
#3 | i2589779-3.patch | 1.42 KB | Jelle_S |
Comments
Comment #2
Jelle_SComment #3
Jelle_SHere's the patch. Sorry I didn't catch this in the other issue :-/
Comment #4
attiks CreditAttribution: attiks at Attiks commentedNice catch of berdir, works
Comment #5
Wim LeersI can't reproduce this.
Comment #6
Jelle_SI was able to reproduce this earlier. If I remember correctly, I used these steps:
Comment #7
Wim LeersIn trying to replicate #6, I found much easier steps to reproduce:
/admin/config/content/formats/manage/restricted_html
Comment #8
Wim LeersFix confirmed.
Comment #9
BerdirChange is risk free and fixes a rather problematic, user facing bug. Not exactly sure how it affects the settings page, but wouldn't be surprised if configuring it there would not work then after the error, especially when aggregation is enabled?
So, tagging with rc target triage.
Comment #10
alexpottDicussed with @effulgentsia - we agree that this should be an RC target since #7 seems very simple for any user to do and as we have no test coverage for JS it seems obvious that we're going to discover more bugs during RC.
Comment #11
alexpottCommitted cea9c14 and pushed to 8.0.x. Thanks!
Comment #13
effulgentsia CreditAttribution: effulgentsia at Acquia commentedThis appears to have caused a regression in #2598070: [regression] CKEditor Link button does not show if HTML filtering is enabled. Can anyone here help review that issue?