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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marthinal created an issue. See original summary.

marthinal’s picture

Issue summary: View changes
FileSize
55.76 KB
joseph.olstad’s picture

**EDIT**
deleted comment for now

joseph.olstad’s picture

ok, 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.

joseph.olstad’s picture

I 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.

marthinal’s picture

Great! Thanks @joseph.olstad!

joseph.olstad’s picture

Status: Needs review » Fixed
joseph.olstad’s picture

joseph.olstad’s picture

Status: Fixed » Needs work

going to revert this commit for 2.16 release

joseph.olstad’s picture

Status: Needs work » Needs review

re-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.

alrh’s picture

We have some tags starting with [[{"type":"media". These tags are no longer matched with the new pattern.

joseph.olstad’s picture

Thanks alhr , I have posted a patch in the other issue
#2942482: Issue 2934596 breaks recognition of media tags

joseph.olstad’s picture

Status: Needs review » Fixed

Regression was fixed in the aforementioned issue (see link in my comment just above this one)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.