fix(markdown): keep the preview-only scroll position across remounts (#1009)

Tab switches and mode toggles unmount MarkdownPreview, whose only
scroll state was the DOM scrollTop; Preview Only started over at the
top. Record the preview's own scrollTop in the per-path live markdown
store and restore it on mount (split mode keeps its editor-driven
sync).
Цей коміт міститься в:
arookieofc authored and GitHub committed 2026-11-03 20:55:10 +08:00
1 джерело 8ca25e1984
коміт bd2df0bd3a
4 files changed
+111 -3

No files matched your search

+1 -1
Переглянути файл
@@ -22,7 +22,7 @@ describe("selectable read-only surfaces", () => {
it("Markdown preview (the reported case)", () => {
act(() =>
useLiveMarkdown.setState({
"/p/README.md": { text: "# Title\n\nSome *text*", topLine: 0, scrollSeq: 0, fontZoom: 0 },
"/p/README.md": { text: "# Title\n\nSome *text*", topLine: 0, scrollSeq: 0, fontZoom: 0, previewTop: 0 },
}),
);
act(() => useMarkdownModes.setState((s) => ({ byPath: { ...s.byPath, "/p/README.md": "preview" } })));