Unable to edit link on an image

Created on 4 September 2024, 7 months ago

Problem/Motivation

I am unable to update the link on an image in the CKEditor5 editor, using the edit link feature. I can go in and edit it, but after I click the checkmark, it changes back to the original link. I was not able to achieve the same result while linking to text, and I have not tested this with embedded media entities, only with embedded images (not media). I have also not yet tested this with internal links. I was only able to work around this by unlinking and adding a new link.

Steps to reproduce

  1. Configure a text format using CKEditor5
  2. Make sure Image and Link are in the active toolbar
  3. Edit the field in a node using that format
  4. Upload an image into that field
  5. Link image to an external site
  6. Save the node
  7. Edit the node again
  8. Click the image
  9. Click the link icon
  10. Click edit
  11. Update the link
  12. Click the checkmark to accept the change
  13. See that the change was not accepted

Proposed resolution

Remaining tasks

  1. Test to see if this problem remains on Drupal 11
  2. Test to see whether this problem occurs with media
  3. Test to see whether this problem occurs with internal links
  4. Fix the bug
🐛 Bug report
Status

Active

Version

10.3

Component
Editor 

Last updated 12 days ago

Created by

🇺🇸United States MegaKeegMan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @MegaKeegMan
  • 🇮🇳India zartab farooquee

    I followed the steps to reproduce the issue, but I was unable to replicate the problem. After editing the image link and saving the changes, the link updated correctly without reverting to the original. I tested this on both external and internal links, and everything is functioning as expected

  • Status changed to Postponed: needs info 7 months ago
  • Thanks for trying to reproduce. I'm tagging this for an update to the reproduction steps.

  • 🇺🇸United States MegaKeegMan

    I have not yet been able to identify what might be causing this. But I will try to reproduce on a fresh installation. Thanks for looking into it.

  • 🇳🇿New Zealand quietone

    Drupal 10.3 is in security mode now and 10.4 is maintenance release, so this is not eligible. Moving to 11.x but this still needs working steps to reproduce.

    If this has been resolved, close the issue. It could help others to explain how it was resolved.

  • 🇨🇳China catcat811

    I can reproduce the issue, and it only occurs when the Text Format is set to Full HTML.

  • 🇧🇷Brazil viniciusrp

    I am facing the same error here with Drupal 10.3 with same steps on description.

  • 🇬🇧United Kingdom MrDaleSmith

    Can confirm the error exists on latest clean installs of D10.4.5 and D11.1.5, and as mentioned in #7 it only occurs when the text format is set to Full HTML.

  • 🇬🇧United Kingdom MrDaleSmith

    Whilst the editor shows the correct link has been added, by the time the form values are validated the original link is in the form state values. Accordingly, this looks to be a problem with the CK Editor JS not getting the value into the Drupal side correctly: clicking the "edit Source" button shows the old URL in the HTML even when the editor shows the updated version.

    Checking "Limit allowed HTML tags and correct faulty HTML" on the Full HTML text format resolves the issue, so it would appear this bug is related to something that isn't done if the HTML tags don't need to be stripped.

  • 🇮🇳India Ishani Patel

    Hello,
    I've followed the steps above mentioned and checked in Drupal version 11.1.5
    Uploaded an image in CKEditor5 also Link the image to the external site and everything is working fine for me.
    I've attached a screencast link for the same.
    Please check and review.
    Screencast Link: https://www.loom.com/share/3b062ba873a741cfa1c202d88f94e37d?sid=2a0948f8...

    Thanks.

  • 🇬🇧United Kingdom MrDaleSmith

    @ishani patel - your video shows that you have the text format set top. basic: the error does not occur if "Limit allowed HTML tags and correct faulty HTML" is checked for the format you are testing against. See #7, #9 and #11

  • 🇮🇳India supriyagupta

    @megakeegman replicated this issue in drupal 11 this is not there. Tested the image with full html and basic html text editor with ckeditor 5 . URLs is getting updated now.

Production build 0.71.5 2024