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.
When I use the "Add media" button in the TinyMCE WYSIWYG toolbar to upload and embed an image, then use the "Insert/Edit Link" button to link the media, the link is lost when the data is saved.
Additionally, if you toggle the "Disable rich-text" you can see that the links are lost even before saving. It's as if TinyMCE isn't considering the media macro ([[{"fid":"81","view_mode":...) as something that can be linked.
But if I disable rich-text and manually add the anchor tags around the macro they work properly and are persistent.
Comments
Comment #1
anthonylindsay CreditAttribution: anthonylindsay commentedThat can also happen in the 7.x-1.x version if you don't have whitespace (spaces or new lines) around your image, I have found.
My guess is that Media's html is a bit broken and the editor is trying to cope by stripping out what is sees as malformed html.
Comment #2
anthonylindsay CreditAttribution: anthonylindsay commentedI should also mention that in my case it was with CKeditor, rather than TinyMCE.
I solved it by turning off the 'source formatting' filter so that the editor did not try to clean up the HTML.
Comment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team