diff --git a/src/Helpers/EmbedHelper.php b/src/Helpers/EmbedHelper.php index e30fcee8..dce59779 100644 --- a/src/Helpers/EmbedHelper.php +++ b/src/Helpers/EmbedHelper.php @@ -14,9 +14,12 @@ public static function renderEmbeds(string $html): string { return preg_replace_callback('/\s*?
\s*?(.*?)\s*?<\/div>.*?<\/figure>/', function (array $matches): string { $embed = self::create($matches[1]); - $url = preg_replace('/\//', '\/', preg_quote($matches[1])); + $url = preg_replace('/\//', '\\/', preg_quote($matches[1])); - return preg_replace("/>\s*?{$url}\s*?{$embed->code?->html}<", $matches[0]); + // Lazy load iframes + $embedCodeWithLazyLoad = str_replace('code?->html); + + return preg_replace("/>\s*?{$url}\s*?{$embedCodeWithLazyLoad}<", $matches[0]); }, $html); }