perf(editor): reduce long-document decoration work and fix fold navigation

This commit is contained in:
2026-09-06 14:30:56 +08:00
parent 750e17212e
commit 874e916106
23 changed files with 9398 additions and 54 deletions
@@ -148,6 +148,10 @@ function foldHeadings(action: 'toggle' | 'all' | 'none') {
const view = ctx.get(editorViewCtx)
const tr = headingFoldTransaction(view.state, action)
if (tr) view.dispatch(tr)
if (action === 'all') {
const viewport = editorRoot.value?.closest<HTMLElement>('.milkdown-host')
if (viewport) viewport.scrollTop = 0
}
})
}
const diagramPreviews = new Map<string, { source: string; apply: (value: HTMLElement) => void }>()