Hi,

There is a major issue when inserting file links using the media browser in the WYSIWYG editor on a content page.

This is easy to reproduce.

1. Take a fresh Panopoly 7.x-1.28 install. (no additional modules, no settings changes at all, no apps installed)
2. Create a new content page and add two links with some text between. (see image 1)
3. Change the text format to "Plain text" which shows that the link code has been inserted incorrectly (example case below)
4. Change the text format back to "WYSIWYG".
5. Publish the page. In this case the first document link is repeated and the text has been lost. (see image 2)

Through various tests this issue appears to affect all file links and gets worse the more you save the same page as eventually all the links switch to the same one. There are numerous issues around the media module which appear to refer to this and it's not new. We have an in-house distro based on Panopoly 7.x-1.25 which has the exact same issue. You don't have to switch text format in the middle of editing to see this happen, it just seems to accelerate it and demonstrate something about what might be going on.

However... We also have another live site which has been running for a while, again based on Panopoly but this site is currently on 7.x-1.21 (yes, yes, we need to upgrade it) which started life on an older Panopoly release (I'm not currently sure which but I believe it was in the teens) and this site does not have this issue and the reason appears to be that instead of inserting the media module style "macro" code it inserts markup instead yet the user goes through the exact same process, they upload a file through the media module file browser and insert it inline in content.

That site is currently running wysiwyg and wysiwyg_filter modules that are the same versions as the current Panopoly release and media is only a couple of alpha releases behind. We have tried swapping the older version of the media module in and it makes no difference. Is there a way to configure Panopoly / media to insert the markup direct and bypass using the media module's macro code? Does anybody on the Panopoly team have any insight into what's going on here? This seems to be a fairly long standing issue and it's pretty major as the example demonstrates.

Any help would be hugely appreciated.

The code at point 3:
<p>[[{"fid":"6","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{"class":"file media-element file-default"},"link_text":"football.odt"}]]</p><p>[[{"fid":"6","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{"class":"file media-element file-default"},"link_text":null}]]</p><p>[[{"fid":"6","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{"class":"file media-element file-default"},"link_text":"politics.odt"}]]</p>

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

specky_rum created an issue. See original summary.

dsnopek’s picture

I'm able to reproduce this on a fresh install of Panopoly 1.28. This looks like a bug in media_wysiwyg. I'd be interested to see if the problem persists after upgrading per #2533688: Update to Media 2.0-beta1 and File Entity 2.0-beta2

dsnopek’s picture

Hrm. I just upgraded Media and tested it. Unfortunately, the problem is still there!

jdearie’s picture

I'm using Panopoly 1.46 and had the same issue. I found a patch in the issue que for the media module that fixed the problem for me.

While it's 3 years old, the patch was updated to include a fix for TinyMCE (as well as CKEditor).
https://www.drupal.org/node/2028231#comment-8866201

The issue is still open, so I'm not sure if it's been resolved in later versions of the media module. Panopoly is on media 7.x-2.1 and the latest release is media 7.x-2.9. I try not to update contrib modules included in panopoly outside of a panopoly update... but with some of the issues i'm running into with media and file entities, i may have to.

i may create a new issue requesting the media module update :)

JeffM2001’s picture

Version: 7.x-1.28 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
484 bytes

Another way to fix this is to disable TinyMCE's keep_styles option: https://www.tinymce.com/docs/configure/content-filtering/#keep_styles

This has the downside of not carrying over any styles (bold, etc.) when you hit enter to start a new paragraph, but IMHO it's a cleaner fix and worth the tradeoff.