WYSIWYG module's onBeforeSetContent and onGetContent call attach and detach on evey WYSIWYG editor. detach calls replacePlaceholderWithToken in media_wysiwyg.filter.js. However, in there Drupal.settings.tagmap is being emptied resulting in tag replacement faults in subsequent attach calls which calls replaceTokenWithPlaceholder.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

piepkrak’s picture

Assigned: Unassigned » piepkrak
piepkrak’s picture

This bug was introduced in commit 72be229179bb4f6f88c66358b1d2f67ded4c0168.

piepkrak’s picture

piepkrak’s picture

Status: Active » Needs review
piepkrak’s picture

Fixed patch file.

The last submitted patch, 3: media-wysiwyg_attach_detach-2328493-3.patch, failed testing.

hart0554’s picture

I've had the same problem and the patch in #5 is working for me, though it now creates some near duplicates in the tagmap because of the assignment in lines 79 - 89, where I have some slight variation in the macro (link_text: null at the end of the media json string in the initial tagmap, not there after calling create_macro at line 83).

piepkrak’s picture

I know it is now possible that the tagmap can now contain duplicate entries, however I wonder in what scenario this will present an issue. If anybody knows more about this please step in.

I might pick this up, but I don't know what the timeline will be on this.

heddn’s picture

adriancotter’s picture

This looks like it fixes #2317519: Blank WYSIWYG with existing multiple Media content.

What is the duplicate tagmap problem? Not sure I understand the description above in #7, and #8.

Adrian

piepkrak’s picture

@heddn: They seem to be duplicates.

@adriancotter: The patch does not clear the tag map, so if media is added, or changed it will add them to the tag map when the WYSIWYG detaches. This is exactly what I think could be an issue. However I am not sure about this. I tried getting some info on the commit that this is about on #drupal-media, but didn't get any feedback. I hope to be able to take some time soon to look further into this.

dariogcode’s picture

#5 fixed my issue. I had several field collections with wyswyg media.

Thanks!

heddn’s picture

Status: Needs review » Reviewed & tested by the community

#7 & #12 mark this as RTBC. Changing the status.

aaron’s picture

Status: Reviewed & tested by the community » Fixed

  • aaron committed 93c5127 on 7.x-2.x
    Issue #2328493 by piepkrak: Async behavior of wysiwyg plugin attach/...
piepkrak’s picture

After looking some more into this we ended up swapping out TinyMCE with CKEditor and Media conform the drush make statements in this snippet: https://gist.github.com/brantwynn/8015543. It seems TinyMCE and WYSIWYG also don't reinitialize properly when AJAX is involved.

With the proposed setup this also is working nicely now.

Status: Fixed » Closed (fixed)

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