Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#90 | 2771837-90.patch | 4.46 KB | andeersg |
#88 | 2771837-88.patch | 5.38 KB | dipakmdhrm |
#86 | 2771837-80.patch | 4.75 KB | Omega_yang |
#82 | 2771837-79.patch | 21.71 KB | kevinhbruce |
#78 | interdiff_77-78.txt | 3.78 KB | vsujeetkumar |
Comments
Comment #2
thpoul CreditAttribution: thpoul at Pixual commentedI was able to reproduce it. This is a nice catch because not only you can't edit the image, but it stops being a widget too.
Comment #3
Wim LeersIt seems like this will block #2510394: [drupalImage] Setting to still allow linking to an image by URL even when uploads are enabled.
Nice find!
Comment #5
ckaotikAs a quick workaround, I've changed these two lines in
/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
to ensure the required attributes are set:Old:
New:
Comment #6
Wim LeersThis is a blocker for #2510394: [drupalImage] Setting to still allow linking to an image by URL even when uploads are enabled.
Comment #7
Wim LeersComment #8
lucaslg CreditAttribution: lucaslg as a volunteer commentedThe workarround in #5 is working well when adding new images.
However, if people with existing images update Drupal with this fix, they still won't be able to edit their images without removing and adding them again. Also, it doesn't work for images added by any other module or ckeditor plugin which does not set the attributes (IMCE for instance).
Should we just make the data-entity attributes optional ?
I am not sure if this would have other impacts but in case of a url, there is no entity, so there is no reason to have the data-entity attribute.
When #2510394: [drupalImage] Setting to still allow linking to an image by URL even when uploads are enabled will be fixed, the dialog would seamlessly display url or file configuration depending on the presence of the attributes.
This patch is an attemp : it removes the requirements on the image widget definition and remove the verification on the parent imageCaption plugin (which is call first when processing an image).
Comment #9
LeisureLarry CreditAttribution: LeisureLarry commentedThanks for the patch. Using IMCE for inline images the missing image widget was really annoying.
Comment #11
lucaslg CreditAttribution: lucaslg as a volunteer commentedComment #13
skylord CreditAttribution: skylord commentedThanks for #8 - must have for old sites migrated from Drupal 6 or similar with huge amount of plain "img" tags.
Comment #14
stianha CreditAttribution: stianha commented#8 fails on Drupal 8.4. Can anyone please update patch?
Comment #15
silver_nmy CreditAttribution: silver_nmy as a volunteer commentedFor Drupal 8.4 I took #5 and modified it oh so slightly:
/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
In core:
Change to:
Difference from #5 is data-entity-type is set to 'image' instead of 'none'. With this, image uploads through IMCE/URL retain their widget upon editing. Haven't found any side effects so far.
Comment #16
Stephen Ollman+1 #8
-1 #15
Comment #17
ericras CreditAttribution: ericras at University of Nebraska commentedUpdate of #8 for Core 8.4
Comment #18
slbrassard CreditAttribution: slbrassard commented#17 allowed me to access the image properties widget on an imce inserted image on 8.4.
Comment #20
marc.groth CreditAttribution: marc.groth commentedAgreed with #18 that #17 allowed me to access the image properties widget for an IMCE inserted image on 8.4... However the 'Image' field is required and isn't auto filled which defeats the purpose of this functionality. At the moment you have to physically upload a new image to be able to save the modal details; whereas we probably want the 'Image' field to be auto filled with the image chosen from the IMCE dialog (the same way it works when you upload an image and then edit it the normal way).
Comment #21
stianha CreditAttribution: stianha commentedAnyone got this working on 8.5?
Comment #22
hilatti CreditAttribution: hilatti at Cyberwoven commented#17 works for me on 8.5
Comment #23
xeM8VfDh CreditAttribution: xeM8VfDh commentedHmm, #20 is concerning. Anyone else confirm that? @hilatti, are you not experiencing #20?
Comment #24
Shane Birley CreditAttribution: Shane Birley commentedI have not been able to get it working on 8.5 -- seems the patch causes the page load to go a bit wonky. The footer for the editor loads but I am unable to load the rest of the editor after applying patch.
Comment #25
xeM8VfDh CreditAttribution: xeM8VfDh commentedthanks for the info @Shane Birley. Hopefully we'll get a working patch soon, as this is kind of a crucial bug that must be driving content editors crazy.
Comment #26
karolus CreditAttribution: karolus as a volunteer commentedI came across this on 8.5, and tried #17, but no changes, the same behavior as before was observed.
Adding the code in #15 by @silver_nmy did work though, and I'll leave that in, for the moment.
Comment #27
rferguson CreditAttribution: rferguson commented@karolus, have you tried this?
https://www.drupal.org/files/issues/2822217-drupalimagecaption-img-src-f...
https://www.drupal.org/node/2822217
Tried this morning and works for me to bring back image propertied/captions.
Comment #28
karolus CreditAttribution: karolus as a volunteer commentedBased on my previous comment on #26, I created a patch. Credit to @silver_nmy
https://www.drupal.org/files/issues/2018-05-08/drupalimage_ckeditor-2771...
Comment #29
karolus CreditAttribution: karolus as a volunteer commented@rferguson Thanks--I only saw your post after I went through to make a patch posted as #28. Will see how it goes.
Comment #30
paper boyI have the same problem as mentioned in #20.
I applied patch from #17 and #28 on Drupal 8.5.4 where users can either upload images using the built in image upload OR Imce File Explorer 8.x-1.6.
I can now successfuly resize images uploaded with imce file explorer. I can also show the image properties but when trying to save the properties I get an error message, saying that an image file is required.
Comment #31
Stephen Ollman#17 & #28 worked perfectly for me. Nice work!
I hope this can make it into the next core release as its an important update to fix an annoying bug.
From a novice content editor point of view that might be using D8, it diminishes the editors usability and therefore their fondness for using Drupal as a CMS, something I think a lot of developers tend to forget.
Comment #33
thejacer87 CreditAttribution: thejacer87 at Acro Commerce commentedre-rolled for 8.6
Comment #34
thejacer87 CreditAttribution: thejacer87 at Acro Commerce commentedsomething added the newline automatically, heres a patch without the newline change if you want
Comment #35
paper boyI can confirm, the patch from #34 works with drupal/core 8.6.x-dev.
It fixes the main problem, that images inserted via URL instead of the image upload widget, can't be resized. After applying the patch, this works well, but still there are problems with images inserted through other means.
As mentioned above, if you install drupal/imce and add the imce image button to the wysiwyg editor's menu, images inserted through the imce widget can not be resized. I guess other image modules are having the same problem, but I didn't try.
Also, if you edit the page source manually and add an img tag there, it would be nice, if it was scaleable after switching back to the wysiwyg editor.
Workaround
If you can't resize an image, added manually or with any other contrib module's widget, just add data-entity-type="image" data-entity-uuid="0" to the img tag's attributes in the page source.
Even tho the imce image upload button's behavior is not fixed with this patch, you can open the imce browser from within the core image widget to get the desired result. Just remove the imce image upload button from the menu and uncheck Enable image uploads.
To insert image from the wysiwyg editor click the default image button and click Open file browser right above the file path field.
Comment #36
jastraat CreditAttribution: jastraat at Technivant commentedWe're also using the patch in #34 successfully.
Comment #37
bernardopaulino CreditAttribution: bernardopaulino commentedPatch in #34 worked and I am still able to resize the images.
Comment #38
jastraat CreditAttribution: jastraat at Technivant commentedMarking as reviewed based on more than one report.
Comment #39
alexpottThanks for filing this bug report and for fixing it. Bug fixing is very valuable. However in order to commit a bug fix we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:
In this case we need to add a javascript test because that's what needs testing. Perhaps we can extend the existing test coverage in
\Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest
to test this.Comment #40
kellyimagined CreditAttribution: kellyimagined commentedneed a combo of #8 and #34. with 8.7.x, number 34 is no longer enough.
Comment #41
xeM8VfDh CreditAttribution: xeM8VfDh commentedAm I the only one who is seeing the same problem, but when I AM adding the image to the page via the Image button? I am using the standard image button, opening the file browser, selecting the image, adding alt text, then saving. When it's saved, it's creating this HTML:
reference: https://www.drupal.org/node/2381651
Comment #42
xeM8VfDh CreditAttribution: xeM8VfDh commented?
Comment #43
lebachai CreditAttribution: lebachai commentedI am seeing the same problem as in #41.
Comment #44
xeM8VfDh CreditAttribution: xeM8VfDh commentedthanks for confirming @lebachai. The result here for me is that I am completely unable to update image configurations across the board on my Drupal 8.7.8 installation. Its outrageously annoying for our content creators/editors.
Comment #45
xeM8VfDh CreditAttribution: xeM8VfDh commentedThis really is actually quite insane... is there truly no way at all in Drupal 8 to edit a image's properties after saving a page initially, or am I missing something? I can't seem to find any way to do so. This issue is so basic and bad that it is, in and of itself, a reason to not use Drupal.
Comment #46
codeelegance CreditAttribution: codeelegance as a volunteer commentedEmbarrassing, really.
5 years and people still can't edit image properties. In a CMS. I hope someone is warm and happy in their test-driven world.
I'm on 8.8.1, and #34 still works for me (via manual editing). However, migrated (existing) images are left out in the cold.
Comment #47
xeM8VfDh CreditAttribution: xeM8VfDh commented"I hope someone is warm and happy in their test-driven world."
hahahaha
@codeelegance, do you think #34 should be merged, or is it only a partial fix? I couldn't quite tell from your comment. Thanks for the feedback.
Comment #48
codeelegance CreditAttribution: codeelegance as a volunteer commentedI initially thought this was good to go, but I didn't apply the patches, I just manually edited the files.
Applying #8 and #34 doesn't seem to work.
More research....
Comment #49
xeM8VfDh CreditAttribution: xeM8VfDh commentedoooooook then lol, thanks for contributing
Comment #50
codeelegance CreditAttribution: codeelegance as a volunteer commentedAfter more research:
I've discovered some things. The reason the patch doesn't work for 8.8 and above is because of the initiative to use es6 Javascript.
The modifications in #8 and #34 need to be made in plugin.es6.js in both the drupalimage, and the drupalimagecaption directories. From what I can see, you don't need to modify plugin.js, but YMMV.
I've created a patch that modifies both versions of the files,.
Comment #51
xeM8VfDh CreditAttribution: xeM8VfDh commentedthanks!!
Comment #52
xeM8VfDh CreditAttribution: xeM8VfDh commentedComment #55
gngn CreditAttribution: gngn at Computer Manufaktur GmbH commentedUsing the patch #50 and drupal 8.7 I get errors like
The "image" entity type does not exist
.Looking around I found a Change record Inserted images now use data-entity-type="file" + data-entity-uuid="" instead of data-editor-file-uuid="" (#2381651) with an example of a correct image:
Changing "image" to "file" in #50 works for me.
Patch coming.
Comment #56
gngn CreditAttribution: gngn at Computer Manufaktur GmbH commentedHere is a modified version of #50 in which I changed 'image' to 'file' in modules/ckeditor/js/plugins/drupalimage/plugin.js
This worked for me with drupal 8.7.
Comment #58
fredonia_webteam CreditAttribution: fredonia_webteam commentedFailure on Drupal 8.9.3. The resize and captions work, can save and edit/resize. When adding a link to the image, the entire ckeditor fails.
Tested #56:
Works as expected, except where image has a link on it, such as:
<a href="/sites/default/files/my.pdf"><img alt="my image" src="/sites/default/files/myimage.jpg"></a>
This occurs using IMCE file manager and have not tested otherwise.
Thank you for all the hard work on this so far!
Comment #59
wombatbuddy CreditAttribution: wombatbuddy commentedThe #56 does the job on Drupal 8.9.6.
It also can be used when images was loaded using the 'IMCE' module (in this case it was impossible to alter align of an uploaded image by clicking on it after saving).
Comment #60
wombatbuddy CreditAttribution: wombatbuddy commenteddeleted of duplicate
Comment #61
genellann CreditAttribution: genellann at On Fire Media commentedRe-rolled For Drupal 9.1.x
Comment #62
dbroll CreditAttribution: dbroll commented+1 for #56 (with IMCE & 8.9.7) - we should get this added to core ASAP for 8.x
Comment #63
TXChetG CreditAttribution: TXChetG commentedRunning Drupal 8.9.13 #56 mostly works, except when an image gets Centered the UUID gets zeroed out. I don't yet understand why it gets displaced in the first place. Any ideas?
Comment #64
nikitagupta CreditAttribution: nikitagupta at Srijan | A Material+ Company for Drupal India Association commentedComment #65
nikitagupta CreditAttribution: nikitagupta at Srijan | A Material+ Company for Drupal India Association commentedComment #66
simbaw CreditAttribution: simbaw commentedComment #67
ankithashettyRerolled the patch in #66, thanks!
Comment #68
Gauravvvv CreditAttribution: Gauravvvv at OpenSense Labs commentedre-rolled patch #67. Attached interdiff for same.
Comment #69
KapilV CreditAttribution: KapilV as a volunteer and at Innoraft for Drupal Care, Drupal Association commentedre-rolled patch #68.
Comment #70
dishabhadra CreditAttribution: dishabhadra at Axelerant commentedFor Drupal 9.1.x above patches #66, #67, #68, #69 are getting failed.
Updating the patch to compatible with Drupal 9.1.x.
Comment #71
simbaw CreditAttribution: simbaw commentedComment #72
simbaw CreditAttribution: simbaw commentedComment #73
volegerRerolled #72 against 9.3.x and fixed CS issues
Comment #74
volegerRerolled patch #65 against 8.9.x
Regenerated plugin.js files based on their *.es6.js source files for #73 as well
Comment #76
skylord CreditAttribution: skylord commentedThanks for #74, works fine for 9.2.4. With #2510394-55: [drupalImage] Setting to still allow linking to an image by URL even when uploads are enabled is a must have for sites with migrated content.
BTW, #2822217-29: DrupalImageCaption plugin does not recognize <img src>, with a manually specified src has some tests suitable for this issue.
Comment #77
vsujeetkumar CreditAttribution: vsujeetkumar at Srijan | A Material+ Company for Drupal India Association commentedFixed the fail test, Please have a look.
Comment #78
vsujeetkumar CreditAttribution: vsujeetkumar at Srijan | A Material+ Company for Drupal India Association commentedTest added, Not too sure it is up to the mark. Please have a look and advise.
Comment #81
kevinhbruce CreditAttribution: kevinhbruce as a volunteer commentedDrupal 9.3.3 broke the last patch. I made a patch of the fix. I tested it with the base files for 9.3.3 and it worked for me. Can someone else test it, please?
Comment #82
kevinhbruce CreditAttribution: kevinhbruce as a volunteer commentedSorry—here is the patch that worked for me:
Comment #84
Wim LeersIt's unfortunate we never got around to fixing this in CKEditor 4, but … we definitely did not repeat this mistake in CKEditor 5!
#3222756: Allow using images from external source just landed, and it handles this *correctly*, on day one, with explicit test coverage 😊
Note: The update path for this issue in CKEditor 4 would've been *very hard*, because we lacked the infrastructure to safely update the
filter_html
settings.If this has been frustrating you for years … then after upgrading from CKEditor 4 → 5 (in the upcoming 9.5.0/10.0.0), you'll notice that
<img data-entity-type data-entity-uuid>
appear in the plugin's settings, for backwards compatibility reasons (to not break existing content). As the site owner, you know your content best, so if you know it's safe to not support those, you can just delete that. And voila! This nightmare will be over for you! ☺️ At last! 😬Comment #85
quietone CreditAttribution: quietone at PreviousNext commentedCKEditor has been removed from core, CKEditor 4 is removed from Drupal Core in 10.0.0
Comment #86
Omega_yang CreditAttribution: Omega_yang as a volunteer commentedAdd new patch for ckeditor contribute module.
Comment #88
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer and at Ashoka for Drupal India Association commentedPatch for someone who's upgrading to 9.5.0 but not planning to update to CKEditor immediately.
Comment #89
uahmed123 CreditAttribution: uahmed123 commented2771837-88.patch does not work for 9.5.3 for CkEditor 4
Comment #90
andeersg CreditAttribution: andeersg at Bouvet commentedThis is the same patch as #88, but created against the module in contrib. It applies on the newest version of Ckeditor 1.0.1.
Looking at the content of the patch I would think it still requires work since it only comments out some things and removes some checks.