diff --git a/resources/views/filament/infolists/entries/normalized-diff.blade.php b/resources/views/filament/infolists/entries/normalized-diff.blade.php index 6daeb07..6ba7040 100644 --- a/resources/views/filament/infolists/entries/normalized-diff.blade.php +++ b/resources/views/filament/infolists/entries/normalized-diff.blade.php @@ -256,44 +256,130 @@ @if ($isScriptContent)
- Diff + Script
View -
@php
-$count = count($ops);
+                                                            
+
+ + Diff + + + Vorher + + + Nachher + +
-for ($i = 0; $i < $count; $i++) { - $op = $ops[$i]; - $next = $ops[$i + 1] ?? null; - $type = $op['type'] ?? null; - $line = (string) ($op['line'] ?? ''); +
+ @php + $rows = []; + $count = count($ops); - if ($type === 'equal') { - echo e($line)."\n"; + for ($i = 0; $i < $count; $i++) { + $op = $ops[$i]; + $next = $ops[$i + 1] ?? null; + $type = $op['type'] ?? null; + $line = (string) ($op['line'] ?? ''); + + if ($type === 'equal') { + $rows[] = [ + 'left' => ['type' => 'equal', 'line' => $line], + 'right' => ['type' => 'equal', 'line' => $line], + ]; + continue; + } + + if ($type === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') { + $rows[] = [ + 'left' => ['type' => 'delete', 'line' => $line], + 'right' => ['type' => 'insert', 'line' => (string) ($next['line'] ?? '')], + ]; + $i++; + continue; + } + + if ($type === 'delete') { + $rows[] = [ + 'left' => ['type' => 'delete', 'line' => $line], + 'right' => ['type' => 'blank', 'line' => ''], + ]; + continue; + } + + if ($type === 'insert') { + $rows[] = [ + 'left' => ['type' => 'blank', 'line' => ''], + 'right' => ['type' => 'insert', 'line' => $line], + ]; + continue; + } + } + @endphp + +
+
+
Alt
+
@php
+foreach ($rows as $row) {
+    $left = $row['left'];
+    $leftType = $left['type'];
+    $leftLine = (string) ($left['line'] ?? '');
+
+    if ($leftType === 'equal') {
+        echo e($leftLine)."\n";
         continue;
     }
 
-    if ($type === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') {
-        echo '- '.e($line)."\n";
-        echo '+ '.e((string) ($next['line'] ?? ''))."\n";
-        $i++;
+    if ($leftType === 'delete') {
+        echo '- '.e($leftLine)."\n";
         continue;
     }
 
-    if ($type === 'delete') {
-        echo '- '.e($line)."\n";
-        continue;
-    }
-
-    if ($type === 'insert') {
-        echo '+ '.e($line)."\n";
-        continue;
-    }
+    echo "\n";
 }
 @endphp
+
+ +
+
Neu
+
@php
+foreach ($rows as $row) {
+    $right = $row['right'];
+    $rightType = $right['type'];
+    $rightLine = (string) ($right['line'] ?? '');
+
+    if ($rightType === 'equal') {
+        echo e($rightLine)."\n";
+        continue;
+    }
+
+    if ($rightType === 'insert') {
+        echo '+ '.e($rightLine)."\n";
+        continue;
+    }
+
+    echo "\n";
+}
+@endphp
+
+
+
+ +
+
Vorher
+
{{ (string) $fromText }}
+
+ +
+
Nachher
+
{{ (string) $toText }}
+
+
@else