Unverified Commit 2c4ace9d authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3100066 by oknate, Wim Leers, alisonjo315: "Convert line breaks into...

Issue #3100066 by oknate, Wim Leers, alisonjo315: "Convert line breaks into HTML" filter should exclude <drupal-media> tag
parent 265e7e9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ function _filter_autop($text) {
  // to avoid messing up code. We look for matched pairs and allow basic
  // nesting. For example:
  // "processed <pre> ignored <script> ignored </script> ignored </pre> processed"
  $chunks = preg_split('@(<!--.*?-->|</?(?:pre|script|style|object|iframe|!--)[^>]*>)@i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
  $chunks = preg_split('@(<!--.*?-->|</?(?:pre|script|style|object|iframe|drupal-media|!--)[^>]*>)@i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
  // Note: PHP ensures the array consists of alternating delimiters and literals
  // and begins and ends with a literal (inserting NULL as required).
  $ignore = FALSE;
+4 −0
Original line number Diff line number Diff line
@@ -376,6 +376,10 @@ public function testLineBreakFilter() {
      "<iframe>aaa</iframe>\n\n" => [
        "<p><iframe>aaa</iframe></p>" => FALSE,
      ],
      // Bug 3097338, paragraphs were appearing around drupalmedia tags.
      '<drupal-media data-caption=" " data-entity-type="media" data-entity-uuid="dbb16f97-cd11-4357-acde-cd09e19e312b"></drupal-media>' => [
        '<p><drupal-media data-caption=" " data-entity-type="media" data-entity-uuid="dbb16f97-cd11-4357-acde-cd09e19e312b"></drupal-media></p>' => FALSE,
      ],
    ];
    $this->assertFilteredString($filter, $tests);