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.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | media-wysiwyg_attach_detach-2328493-3.patch | 643 bytes | piepkrak |
#3 | media-wysiwyg_attach_detach-2328493-3.patch | 787 bytes | piepkrak |
Comments
Comment #1
piepkrak CreditAttribution: piepkrak commentedComment #2
piepkrak CreditAttribution: piepkrak commentedThis bug was introduced in commit 72be229179bb4f6f88c66358b1d2f67ded4c0168.
Comment #3
piepkrak CreditAttribution: piepkrak commentedComment #4
piepkrak CreditAttribution: piepkrak commentedComment #5
piepkrak CreditAttribution: piepkrak commentedFixed patch file.
Comment #7
hart0554 CreditAttribution: hart0554 commentedI'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).
Comment #8
piepkrak CreditAttribution: piepkrak commentedI 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.
Comment #9
heddnSo, are #2285865: Media module cannot replace placeholders in WYSIWYG if page contains more than one editor. & #2317519: Blank WYSIWYG with existing multiple Media content duplicates or a different issue?
Comment #10
adriancotter CreditAttribution: adriancotter commentedThis 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
Comment #11
piepkrak CreditAttribution: piepkrak commented@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.
Comment #12
dariogcode CreditAttribution: dariogcode commented#5 fixed my issue. I had several field collections with wyswyg media.
Thanks!
Comment #13
heddn#7 & #12 mark this as RTBC. Changing the status.
Comment #14
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/93c5127.
Comment #16
piepkrak CreditAttribution: piepkrak commentedAfter 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.