AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(diagram): keep inserted nodes on canvas
tianma-if97d0785c71de
diff --git a/apps/web/src/components/DiagramEditorPane.test.mjs b/apps/web/src/components/DiagramEditorPane.test.mjsindex f18756e0..0dfed31e 100644--- a/apps/web/src/components/DiagramEditorPane.test.mjs+++ b/apps/web/src/components/DiagramEditorPane.test.mjs@@ -54,6 +54,9 @@ describe("diagram editor keyboard workflow", () => {source.indexOf("const suspendScrollerAutoResize"),source.indexOf("const nodeEditorState"),);+ expect(settleHelper.indexOf("ensureDiagramPaperContainsNodes(graph)")).toBeGreaterThan(+ settleHelper.indexOf("scroller.updateScroller()"),+ );expect(settleHelper).not.toContain("graph.centerPoint");expect(settleHelper).toContain("anchorAfter.left - anchorBefore.left");expect(settleHelper).toContain("anchorAfter.top - anchorBefore.top");diff --git a/apps/web/src/components/DiagramEditorPane.tsx b/apps/web/src/components/DiagramEditorPane.tsxindex 5e6634fd..7346a4c0 100644--- a/apps/web/src/components/DiagramEditorPane.tsx+++ b/apps/web/src/components/DiagramEditorPane.tsx@@ -947,6 +947,11 @@ const suspendScrollerAutoResize = (if (!isCurrent()) return;scroller.enableAutoResize();scroller.updateScroller();+ // Scroller.update() can retain the pre-insert paper size even though the+ // model already contains the new cell. Refit from model geometry before+ // restoring the viewport anchor so the new node and the existing diagram+ // cannot be clipped until the editor is reloaded.+ ensureDiagramPaperContainsNodes(graph);if (!restoreAnchor || !anchorView || !anchorBefore) return;const keepAnchor = () => {if (!isCurrent() || !anchorView || !anchorBefore) return;