fix: prevent script diff indentation and add scroll

This commit is contained in:
Ahmed Darrazi 2026-01-01 21:47:32 +01:00
parent a6b1a8913b
commit 75a87a77ae

View File

@ -262,32 +262,38 @@
View View
</summary> </summary>
<div class="mt-2 overflow-x-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre"> <pre class="mt-2 max-h-96 overflow-auto font-mono text-xs text-gray-800 dark:text-gray-200 whitespace-pre">@php
@php $count = count($ops);
$count = count($ops);
@endphp
@for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++) {
@php $op = $ops[$i];
$op = $ops[$i]; $next = $ops[$i + 1] ?? null;
$next = $ops[$i + 1] ?? null; $type = $op['type'] ?? null;
@endphp $line = (string) ($op['line'] ?? '');
@if ($op['type'] === 'equal') if ($type === 'equal') {
{{ $op['line'] }} echo e($line)."\n";
@elseif ($op['type'] === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') continue;
<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- {{ $op['line'] }}</span> }
<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ {{ $next['line'] }}</span>
@php if ($type === 'delete' && is_array($next) && ($next['type'] ?? null) === 'insert') {
$i++; echo '<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.e($line)."</span>\n";
@endphp echo '<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.e((string) ($next['line'] ?? ''))."</span>\n";
@elseif ($op['type'] === 'delete') $i++;
<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- {{ $op['line'] }}</span> continue;
@elseif ($op['type'] === 'insert') }
<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ {{ $op['line'] }}</span>
@endif if ($type === 'delete') {
@endfor echo '<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.e($line)."</span>\n";
</div> continue;
}
if ($type === 'insert') {
echo '<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.e($line)."</span>\n";
continue;
}
}
@endphp</pre>
</details> </details>
</div> </div>
@else @else