Problem/Motivation
We noticed that when adding two videos on the same line in the HTML, the filter would not replace them.
Steps to reproduce
Add something like this to the HTML:
<p>{"preview_thumbnail":"/sites/default/files/styles/video_embed_wysiwyg_preview/public/video_thumbnails/B54L7ABWCrA.jpg?itok=7tr1jHG3","video_url":"https://youtu.be/B54L7ABWCrA","settings":{"responsive":true,"width":"854","height":"480","autoplay":false},"settings_summary":["Embedded Video (Adaptatif)."]}</p><p>{"preview_thumbnail":"/sites/default/files/styles/video_embed_wysiwyg_preview/public/video_thumbnails/MGJw7yOblDE.jpg?itok=S9CqaOKh","video_url":"https://youtu.be/MGJw7yOblDE","settings":{"responsive":true,"width":"854","height":"480","autoplay":false},"settings_summary":["Embedded Video (Adaptatif)."]}</p>
Because it is greedy, the regex in VideoEmbedWysiwyg::getValidMatches()
captures this as one single group.
Proposed resolution
The regex should be ungreedy and should probably look for the first closing </p>
.