flip order

This commit is contained in:
Michael Freno
2025-12-26 19:57:28 -05:00
parent 64f64002f7
commit 4828677828

View File

@@ -3880,9 +3880,10 @@ export default function TextEditor(props: TextEditorProps) {
}
>
<div class="space-y-2">
<For each={history()}>
<For each={[...history()].reverse()}>
{(node, index) => {
const isCurrent = index() === currentHistoryIndex();
const correctIndex = history().length - 1 - index(); // Reverse index
const isCurrent = correctIndex === currentHistoryIndex();
return (
<div
class={`hover:bg-surface1 flex cursor-pointer items-center justify-between rounded-lg border p-3 transition-colors ${
@@ -3890,7 +3891,7 @@ export default function TextEditor(props: TextEditorProps) {
? "border-blue bg-surface1"
: "border-surface2"
}`}
onClick={() => restoreHistory(index())}
onClick={() => restoreHistory(correctIndex)}
>
<div class="flex items-center gap-3">
<span