In the detach method of the WYSIWYG integration code, media turns the content string into a jQuery object and returns the result of its html() method. If you have a script tag in your content, it is added to the jQuery object at index 1 with the wrapping div at index 0. html() only returns the html contents of the first matched element, which means that the script tag at index 1 (and any other items that are added to other indexes of the jQuery object) are lost.
This is obviously less than ideal.
Comments
Comment #1
james.elliott commentedComment #2
james.elliott commentedSomething that should immediately stand out is the match length check. I couldn't seem to figure out how to get the regex to not match " as well as the image tags.
Comment #3
james.elliott commentedah, and I wasn't remembering to group the regex to match more than one image tag.
New patch should fix all.
Comment #4
effulgentsia commentedMinor code style cleanup.
Comment #6
effulgentsia commentedCommitted to 1.x and 2.x.
Comment #7
ParisLiakos commentedSorry but this patch broke the
Generic filedisplay.It hitted me after i updated to 7.x-1.0-rc2 and went through the changes one by one and thats what breaks it:/
steps to reproduce:
-Go to file types in configuration and then to manage file display.
-Set a display to use Generic file.
-Go to add content and use the wysiwyg button to add a file.
-Choose the display you previously set to display generic file.
-Save the node.
-No filename just a random icon instead of the expected file icon with a link to the filename
Comment #8
becw commented@rootatwc I can duplicate your bug in the 7.x-2.x branch. The patch from comment #10 of #1451316: Clean up wysiwyg-media.js fixes this issue but needs testing.
Comment #9
ParisLiakos commentedpatch there fixes it indeed so i am closing this