Problem/Motivation
Currently the photoswipe logic just loops over all elements in the DOM which are an img node. If a content editor in the CKEditor already added a link around the image (a tag) you end up with an A tag in an A tag which is malformed HTML. The browser will try to correct this by putting the first A tag above the other elements, but this results in the content editors link not working.
The end game would be #3546923: Make the swiper toggle-able in CKEditor, but I think this is a great in between step.
Steps to reproduce
In a photoswipe enabled CKEditor, upload an image and add in the ckeditor a link to https://google.com. Observe the rendered HTML.
Proposed resolution
Check all parents if there is an A tag already around the DOM element. If present we skip the photo swipe logic.
Remaining tasks
MR
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Issue fork photoswipe_inline-3560724
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
bramdriesenComment #4
ivnishCould you add a simple test? :)
Comment #5
bramdriesenDone
Comment #7
ivnishMerged! Thank you!