Closed (duplicate)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Mar 2012 at 17:01 UTC
Updated:
5 Dec 2014 at 21:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidDo you use the WYSIWYG module? What admin theme do you use?
Comment #2
becw commentedThis is an issue specifically with WYSIWYG fields in the "edit media" CTools modal. Other fields (for example, a taxonomy term reference autocomplete field) work as expected. This probably means that content in the WYSIWYG field isn't getting pushed back into the real textarea, so it's possible that detach/unload events aren't getting called.
This issue does not happen with the media module's modal, for example with the patch from #1 in #1426730: Automatically open the file edit modal after uploading a file, so it may be specific to the CTools modal.
Comment #3
becw commentedTo duplicate:
admin/content/fileYou can work around this bug by avoiding the use of WYSIWYG for fields on files.
Comment #4
becw commentedComment #5
gleroux02 commentedThanks becw, you beat me to it. It is definitely the WSYSIWYG that is causing the issue.
Comment #6
dddave commentedSix months have passed and there are no follow ups. Is this still an issue?
Comment #7
becw commentedYes, this is still an open issue.
Comment #8
justindodge commentedHey ya'll. I was running up against this issue and found a culprit.
In modules/media_wysiwyg/js/media_wysiwyg.filter.js within
replacePlaceholderWithToken(), the WYSIWYG markup for media elements gets converted back to "macros" as they're referred to in code. This process relies on a search and replace in javascript - however the HTML that is passed to the function gets altered in the process of being parsed by jQuery (attributes change order) and the.replace()fails for that reason.For example:
In
replacePlaceholderWithToken(), this discombobulation happens when .media-elements are iterated through:$('.media-element', content).each(function(i, element) { ...Shortly after, the search and replace is attempted:
but it fails because
markuphas HTML who's attributes have been jumbled around, and hence can't be found withincontent.My solution is to "normalize" the HTML before the iterator and search/replace happens, like so:
Attached is a patch to that effect against the latest 7.x-2.x-dev checkout.
Comment #9
justindodge commentedOn a side note, I just happened to stumble across #2126755: Improve Media's WYSIWYG Macro handling, and it looks like the rewrites there will ultimately include this same type of fix within the same code and function, although that issue is fairly deep and long running.
Edit: Tried to make this a 'related issue' but couldn't seem to get it to stick. Maybe that's broken right now?
Comment #10
justindodge commentedI'm pretty sure this issue has been superseded by the one I referenced in #9, and I'm pretty sure all has been resolved, or at the very least moving on in new issues with subsequent matters will be more appropriate.
I think it's best to shut 'er down.
So, closing. Good night!