We recently had a case where a content editor was using double brackets "[[ SOME COMMENT]]" for comments in a scientific article. This caused the WYSIWYG editor to display an empty value due to a JSON parsing error (due to line 144 on wysiwyg-media.js). I don't believe this is too much of an edge case either because there are other formats/conventions that rely on double brackets (Wiki format for links).
Enclosed is a patch that seems to solve the problem. It modifies wysiwyg-media.js with a try/catch around where the JSON parsing happens. If it doesn't parse, it moves on. Could someone with more knowledge with the media module review?
Comment | File | Size | Author |
---|---|---|---|
#2 | media_wysiwyg_json_check.patch | 1.11 KB | JacobSingh |
media_wysiwyg-media.patch | 1.2 KB | ngmaloney | |
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedComment #2
JacobSingh CreditAttribution: JacobSingh commentedThis looks really good. Thank you. I committed the attached (slightly rerolled). In the future, you should roll your patches from the base of the module itself (i.e. media).
Best,
Jacob