Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
ckeditor.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 May 2014 at 10:20 UTC
Updated:
4 Jan 2016 at 20:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedComment #2
wim leersGreat catch! That's definitely a bug. Reproduced. Will definitely fix. If only we had the ability to run JS tests… :(
captionis the generic class that gets added, but by setting adata-captionattribute on e.g. a blockquote, preformatted code block or video, you can also caption those. We want you to be able to target those captions separately via CSS, hence the extra classes. From Bartik's CSS:Comment #3
yvesvanlaer commentedJust saying that this is still an issue.
Trying to fix this but I'm not sure if I could find a solution.
Comment #4
wim leersThis is not a big bug, so could conceivably go into 8.0.x. Hence not tagging , because there are much more important CKEditor issues that are RC targets. I want to maximize the probability of those fixes going in.
Note that this affects:
classattribute on the<img>tagI've been debugging this for well over an hour. I know this is happening somewhere in CKEditor's
image2plugin, which thedrupalimagecaptionplugin extends. But I've been unable to pinpoint the exact root cause. So, I opened a CKEditor ticket to call in their help: http://dev.ckeditor.com/ticket/13888.For now, I'm just going to fix this on the Drupal side.
Comment #5
wim leersNote this is a subtle/minor data corruption bug.
Comment #6
wim leers… and hence it should ideally be fixed before release.
Comment #7
wim leersAnother hour of so of extremely painful debugging (the widget system is very complex) later and I have the solution. The problem is the combination of:
image2_captionedClasssettingimage2dynamically assigns widget styles (which includes these classes) to a different element based on whether it is captioned or not (seegetStyleableElement())image2_captionedClassanyway, so it's only re-adding some classes that already exist, plus it's actually wrong for those classes to be applied always, because they should only be applied when the image actually is captionedIMO that part of CKEditor is in need of drastic simplification.
For now, the solution on the Drupal side is simple: opt out from all that complexity.
Comment #8
yched commented@wim++ ! Ouch, yeah, widgets are cool but the internals can be messy :-/ And I got lost between CK's image2 and our own override last time I looked there.
The fix seems to make sense, however I'm not at home for another couple days, so I can't in good faith say I have actually tested it. Anyone ? The IS contains steps to reproduce...
Nitpicks :
- "whatever the main element is of the widget" : order wrong looks of the sentence ;-)
- last comment sentence looks unfinished ?
Comment #9
wim leersComment #10
yched commentedI think that should be "whatever the main element of the widget is" ?
Comment #11
wim leersI think you're right. Dutch word order getting in the way, because that made it feel natural to me I think :)
Thanks for your patience!
Comment #12
yched commented;-)
Now we just need someone else to manually test this, I won't be able to before another couple days.
Comment #13
mlewand commentedI feel like your proposed solution is a little too strict, are you sure you want to cut extensibility from your plugin? With this approach any other plugin can't effectively add any classes to the widget.
e.g.
myWidget.addClass( 'foo' )instead you might consider filtering them out:
That will bring few LoC but provide more extensibility if it's what you're caring for.
Comment #14
wim leersExcellent suggestion! Implemented. Updated the comment accordingly.
Comment #15
mlewand commentedAlright now it looks better, +1.
Comment #16
wim leersGiven @mlewand from the CKEditor team has signed off on this, RTBC'ing.
Also significantly revamped the IS.
Comment #17
wim leersComment #18
yched commentedEven better :-) Thanks @mlewand !
Comment #19
xjmDiscussed with @effulgentsia. Since this bug does not impact the actual output -- only essentially whether you see unexpected gray boxes in the editor -- the impact does not seem high enough to merit the risk of any regression during RC, especially because of the lack of frontend testing. That said, this would be acceptable for a patch release. So let's fix this after 8.0.0. Untagging and leaving RTBC.
Thanks!
Comment #20
alexpottIt'd be great to have some test evidence on issue to compensate for the lack of automated testing.
Comment #21
thpoul commented@alexpott here you go :)
I have reproduced the bug as described by @yched on 8.0.x. Screenshots A-01, A-02, B-01, B-02, B-03 demonstrate the problem.
After applying #14 by @wimleers the image caption can get removed as expected. Screenshots C-01, C-02, C-03 demonstrate the outcome.
Comment #22
wim leersThanks for your thorough review, @thpoul!
Comment #23
alexpottCommitted f8b7bd2 and pushed to 8.0.x and 8.1.x. Thanks!
Comment #26
nod_