Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(web): prevent exposed background when expanding the diagram editor

tianma-if57be7701635f
diff --git a/apps/web/src/components/DiagramEditorPane.test.mjs b/apps/web/src/components/DiagramEditorPane.test.mjs
index 20a1178b..6f2c6cd1 100644
--- a/apps/web/src/components/DiagramEditorPane.test.mjs
+++ b/apps/web/src/components/DiagramEditorPane.test.mjs
@@ -96,6 +96,9 @@ describe("diagram editor canvas surface", () => {
expect(source).not.toContain("attachDiagramScroll");
expect(globalStyles).toContain(".edgeever-diagram-scroller");
expect(globalStyles).toContain("scrollbar-gutter: stable");
+ expect(globalStyles).toContain("--edgeever-diagram-canvas");
+ expect(globalStyles).toContain("min-width: 100%");
+ expect(globalStyles).toContain("min-height: 100%");
expect(globalStyles).toContain('data-panning="true"');
expect(globalStyles).toContain("cursor: grabbing !important");
});
diff --git a/apps/web/src/components/DiagramEditorPane.tsx b/apps/web/src/components/DiagramEditorPane.tsx
index 9e623479..0d2fd826 100644
--- a/apps/web/src/components/DiagramEditorPane.tsx
+++ b/apps/web/src/components/DiagramEditorPane.tsx
@@ -777,7 +777,9 @@ const applyDiagramSurface = (
appearance: DiagramAppearance,
kind?: DiagramDocument["kind"],
) => {
- graph.drawBackground({ color: diagramCanvasColor(kind ?? "mind-map", theme, appearance) });
+ const color = diagramCanvasColor(kind ?? "mind-map", theme, appearance);
+ graph.drawBackground({ color });
+ getDiagramScroller(graph)?.container.style.setProperty("--edgeever-diagram-canvas", color);
if (kind === "architecture" || kind === "flowchart") {
graph.drawGrid({
type: "dot",
diff --git a/apps/web/src/components/ai-sidebar/AiSidebar.tsx b/apps/web/src/components/ai-sidebar/AiSidebar.tsx
index cf54611c..83dfc11c 100644
--- a/apps/web/src/components/ai-sidebar/AiSidebar.tsx
+++ b/apps/web/src/components/ai-sidebar/AiSidebar.tsx
@@ -1784,14 +1784,18 @@ export function AiSidebar(props: AiSidebarProps) {
</AnimatePresence>
<m.aside
initial={false}
- animate={narrow ? { x: open ? 0 : "100%", width: panelWidth } : { x: 0, width: open ? width : 0 }}
+ animate={narrow ? { x: open ? 0 : "100%" } : { x: 0 }}
transition={resizing ? { duration: 0 } : sidebarRevealTransition}
aria-hidden={!open}
aria-label={t("aiAssistant.sidebar.title")}
inert={open ? undefined : true}
+ style={{ width: narrow ? panelWidth : (open ? width : 0) }}
className={cn(
- "h-full min-h-0 shrink-0 overflow-hidden bg-card",
- narrow ? "fixed inset-y-0 right-0 z-50 shadow-xl" : "relative",
+ "h-full min-h-0 min-w-0 shrink-0 overflow-hidden bg-card",
+ narrow
+ ? "fixed inset-y-0 right-0 z-50 shadow-xl"
+ : "relative transition-[width] duration-[320ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
+ !narrow && resizing && "transition-none",
)}
onDragOverCapture={(event) => {
if (event.dataTransfer?.types?.includes("Files")) event.preventDefault();
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 8366f8fc..70931e7e 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -724,6 +724,15 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
height: auto !important;
overscroll-behavior: contain;
scrollbar-gutter: stable;
+ background-color: var(--edgeever-diagram-canvas, transparent);
+}
+
+/* The scroller sizes its paper once. When the editor column later grows
+ * (assistant sidebar closing, pane resize), keep the dotted surface covering
+ * the viewport instead of leaving the card color exposed on the right. */
+.edgeever-diagram-scroller > .x6-graph-scroller-content {
+ min-width: 100%;
+ min-height: 100%;
}
.edgeever-diagram-scroller .edgeever-diagram-canvas {