Problem/Motivation

Double-clicking on link within editable caption launches drupallink dialog. Updating the link fails to update the saved markup.

https://www.drupal.org/files/issues/2019-06-15/caption%20link%20bug.mov

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oknate created an issue. See original summary.

oknate’s picture

Status: Active » Needs review
FileSize
1.46 KB

Test only patch, should fail. It demonstrates the bug.

oknate’s picture

Issue summary: View changes
oknate’s picture

Interestingly, the change is present if you view the editable caption this way:

var editor = CKEDITOR.instances['edit-body-0-value'];
var figcaption = editor.widgets.getByElement(editor.editable().findOne('figcaption'));
console.log(figcaption.editables.caption.$.outerHTML);

But if you press the source button, it doesn't show.

Also, if you hit the "Save" button and check the output on the saved host node, it doesn't show the change.

Status: Needs review » Needs work

The last submitted patch, 2: 3062034-2--TEST-ONLY.patch, failed testing. View results

oknate’s picture

Issue summary: View changes

If you put a print statement in captionEditableMutationObserver, you'll see it's not called when the link is edited with the drupalink dialog.

oknate’s picture

Status: Needs work » Needs review
FileSize
1.96 KB
2.77 KB

It works if you set attributes to true in the mutation observer:

-            var config = {characterData: true, attributes: false, childList: true, subtree: true};
+            var config = {characterData: true, attributes: true, childList: true, subtree: true};

Is that going to break something else? What was the rationale behind setting that to false?

The last submitted patch, 7: 3062034-7--TEST-ONLY.patch, failed testing. View results

Wim Leers’s picture

Title: Caption link not updating » `href` in caption editable not updating when using DrupalLink
Status: Needs review » Reviewed & tested by the community
Issue tags: +Media Initiative
FileSize
1.49 KB
3.05 KB

Great find, correct fix, I only want to tweak the test coverage a bit.

  • Wim Leers committed ffe50e4 on 8.x-1.x authored by oknate
    Issue #3062034 by oknate, Wim Leers: `href` in caption editable not...
Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

🚢

oknate’s picture

Fantastic, thanks!

Wim Leers’s picture

Component: Code » CKEditor integration

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.