]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7048 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 22 Aug 2024 15:51:40 +0000 (17:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 22 Aug 2024 15:51:40 +0000 (17:51 +0200)
app/Models/ToolWebflow.php
app/Services/Webflow.php

index 133f9d7a523a293c8b48ac1a1eb5e7d0bfe81fdc..69f8102ba5f67230cc59d2c1e3c2fe07ddbb812e 100644 (file)
@@ -533,7 +533,9 @@ class ToolWebflow extends ToolboxTranslatableModel
 
         // Texts
         foreach ($texts as $text => $translation) {
-            $html = str_replace('>' . $text . '<', '>' . $translation . '<', $html);
+            $pattern = '/>(\s*)(' . addcslashes($text, './()[]{}') . ')(\s*)</';
+
+            $html = preg_replace($pattern, '>${1}' . $translation . '${3}<', $html);
         }
         // Images
 
index 5b1c4beb9fc6d90b4dfd6f89d42f4787b92933d2..15c57f80bbbb108acd6faa306d17c4ec8aa21d80 100644 (file)
@@ -382,8 +382,7 @@ class Webflow
     protected static function addTexts($texts, &$array)
     {
         foreach ($texts as $t) {
-            $t = trim($t);
-            if (!$t) {
+            if (!trim($t)) {
                 continue;
             }
             $paragraphs = preg_split('/\v{2,}/', $t);