mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-03 19:47:03 +00:00
fix(editor): isolate undo history per chapter
Key the editor by chapter id so each chapter gets a fresh TipTap instance with its own history. Previously a single instance was reused across chapters, so the content swap entered the undo stack and Ctrl+Z after switching restored the prior chapter's doc into the current one, which autosave then persisted. With remount, save the cursor/scroll position on unmount (from a ref, not the editor, which is destroyed by then) and load it on mount, replacing the in-place chapter-switch bookkeeping. Claude-Session: https://claude.ai/code/session_01RzTWrLiy4zGuw2hZSQGamk
This commit is contained in:
1 parent
92941a2758
commit
c0da4c53db
2 files changed
+13
-17
No files matched your search
@@ -263,6 +263,7 @@ export function EditorView() {
|
||||
)}
|
||||
</header>
|
||||
<Editor
|
||||
key={chapter.id}
|
||||
bookId={book.id}
|
||||
chapterId={chapter.id}
|
||||
content={chapter.content}
|
||||
|
||||
Reference in new issue
Block a user