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.
We need to display "[[" in a <code>
tag. When you add this tag first and then an image, the result is that the text doesn't appear as expected.
For example:
IMHO we can avoid this problem by detecting "[[{" instead of "[["
Basically:
define('MEDIA_WYSIWYG_TOKEN_REGEX', '/\[\[\{.+?"type":"media".+?\}\]\]/s');
instead of
define('MEDIA_WYSIWYG_TOKEN_REGEX', '/\[\[.+?"type":"media".+?\]\]/s');
Here is the result:
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#2 | Screen Shot 2018-01-05 at 9.34.57 AM.png | 55.76 KB | marthinal |
double-square-brackets-media-wysiwyg.patch | 578 bytes | marthinal | |
| |||
Screen Shot 2018-01-05 at 9.36.44 AM.png | 231.86 KB | marthinal | |
Screen Shot 2018-01-05 at 9.36.11 AM.png | 138.35 KB | marthinal | |
Screen Shot 2018-01-05 at 9.50.26 AM.png | 136.76 KB | marthinal |
Comments
Comment #2
marthinal CreditAttribution: marthinal at Bluespark commentedComment #3
joseph.olstad**EDIT**
deleted comment for now
Comment #4
joseph.olstadok, looks reasonable, however this regex needs a bit of review because it is responsible for how the media embed works, before any commit this needs to be reviewed thoroughly to make sure no regressions.
Comment #5
joseph.olstadI haven't yet had time to do a thorough review. Looks good though at first glance. Again, this regex is very important so want to take a closer look, hopefully soon.
Comment #6
marthinal CreditAttribution: marthinal at Bluespark commentedGreat! Thanks @joseph.olstad!
Comment #9
joseph.olstadComment #10
joseph.olstadComment #11
joseph.olstadgoing to revert this commit for 2.16 release
Comment #12
joseph.olstadre-testing, haven't yet found an issue with this.
so maybe leave it as is in 2.15
seems to work as far as my tests show. One reported issue, but maybe pebkac issue.
Comment #13
alrh CreditAttribution: alrh commentedWe have some tags starting with [[{"type":"media". These tags are no longer matched with the new pattern.
Comment #14
joseph.olstadThanks alhr , I have posted a patch in the other issue
#2942482: Issue 2934596 breaks recognition of media tags
Comment #15
joseph.olstadRegression was fixed in the aforementioned issue (see link in my comment just above this one)