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(web): reclaim editor space around floating AI launcher
tianma-ifc9132b5191dd
diff --git a/apps/web/src/components/EditorOutline.tsx b/apps/web/src/components/EditorOutline.tsxindex f1ebbe9a..54a920d2 100644--- a/apps/web/src/components/EditorOutline.tsx+++ b/apps/web/src/components/EditorOutline.tsx@@ -320,7 +320,7 @@ export const EditorOutline = ({ editor, memoId, editingMemoIdRef, scrollContaine"select-none overflow-x-hidden",collapsed? "pointer-events-auto absolute inset-0 overflow-hidden"- : "sticky top-6 h-fit max-h-[calc(100vh-8rem)] shrink-0 overflow-y-auto py-2"+ : "sticky top-6 h-fit max-h-[calc(100vh-8rem)] shrink-0 overflow-y-auto pt-2 pb-16")}style={!collapsed ? { width: EDITOR_OUTLINE_WIDTH } : undefined}aria-label={t("editor.outline")}diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsxindex a31d5ff5..02b56e7b 100644--- a/apps/web/src/components/EditorPane.tsx+++ b/apps/web/src/components/EditorPane.tsx@@ -3929,7 +3929,6 @@ const RichEditorPane = ({&& !phonePreviewOpen;const outlineReservesSpace = showDocumentOutline && !editorOutlineCollapsed;const compactEditorReadingGutter = shouldCompactEditorReadingGutter({- aiAssistantOpen,desktopColumn: isDesktopColumn,columnWidth: Math.max(0, editorColumnWidth - editorScrollbarGutter * 2),articleMaxWidth: Number.parseInt(EDITOR_CONTENT_MAX_WIDTH, 10),@@ -4738,6 +4737,7 @@ const RichEditorPane = ({</ClipboardCopyNotice>)}+ {/* Overlay the article/outline; horizontal space belongs to the document. */}{!effectiveReadOnly && !aiAssistantOpen ? (<IconTooltipside="left"diff --git a/apps/web/src/lib/editor-reading-gutter.test.mjs b/apps/web/src/lib/editor-reading-gutter.test.mjsindex f56a1ee5..4404cf34 100644--- a/apps/web/src/lib/editor-reading-gutter.test.mjs+++ b/apps/web/src/lib/editor-reading-gutter.test.mjs@@ -12,28 +12,25 @@ const comfortableWithOutline =standardReading + outlineBesideArticle + EDITOR_DESKTOP_READING_GUTTER_PX * 2;describe("editor reading gutter", () => {- test("keeps the 6rem gutters when the assistant is closed", () => {+ test("returns narrow-window space to the article even with the assistant closed", () => {expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: false,desktopColumn: true,columnWidth: 920,articleMaxWidth: standardReading,reservedBesideArticle: outlineBesideArticle,- })).toBe(false);+ })).toBe(true);});- test("compacts once an open assistant leaves no room for the article, outline, and 6rem gutters", () => {+ test("compacts when the column cannot fit the article, outline, and 6rem gutters", () => {expect(comfortableWithOutline).toBe(1404);expect(EDITOR_PANE_TIGHT_PX).toBe(720);expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 920,articleMaxWidth: standardReading,reservedBesideArticle: outlineBesideArticle,})).toBe(true);expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: comfortableWithOutline,articleMaxWidth: standardReading,@@ -43,14 +40,12 @@ describe("editor reading gutter", () => {test("keeps the wide reading measure when that column still fits", () => {expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 1600,articleMaxWidth: 1040,reservedBesideArticle: outlineBesideArticle,})).toBe(false);expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 1563,articleMaxWidth: 1040,@@ -60,14 +55,12 @@ describe("editor reading gutter", () => {test("leaves the narrower breakpoints and an unmeasured column alone", () => {expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: false,columnWidth: 800,articleMaxWidth: standardReading,reservedBesideArticle: outlineBesideArticle,})).toBe(false);expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 0,articleMaxWidth: standardReading,@@ -77,7 +70,6 @@ describe("editor reading gutter", () => {test("uses the 1400px focus row when deciding", () => {expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 1800,articleMaxWidth: 960,@@ -85,7 +77,6 @@ describe("editor reading gutter", () => {focusRow: true,})).toBe(true);expect(shouldCompactEditorReadingGutter({- aiAssistantOpen: true,desktopColumn: true,columnWidth: 1800,articleMaxWidth: 960,diff --git a/apps/web/src/lib/editor-reading-gutter.ts b/apps/web/src/lib/editor-reading-gutter.tsindex 87ec0aaf..6c41e421 100644--- a/apps/web/src/lib/editor-reading-gutter.ts+++ b/apps/web/src/lib/editor-reading-gutter.ts@@ -28,26 +28,24 @@ export const editorColumnFitsDesktopReadingGutters = ({columnWidth >= articleMaxWidth + reservedBesideArticle + EDITOR_DESKTOP_READING_GUTTER_PX * 2;/**- * While the companion sidebar is open, yield the 6rem reading gutters as soon- * as the column can no longer hold the chosen article width, the outline, and- * those gutters. The shared `lg:` gutter stays 6rem for every other width.+ * Yield the 6rem gutters whenever the editor column cannot fit the article+ * and outline at their preferred widths. The floating AI launcher overlays+ * either surface; it must not require a dedicated strip beside the outline.*/export const shouldCompactEditorReadingGutter = ({- aiAssistantOpen,desktopColumn,columnWidth,articleMaxWidth,reservedBesideArticle = 0,focusRow = false,}: {- aiAssistantOpen: boolean;desktopColumn: boolean;columnWidth: number;articleMaxWidth: number;reservedBesideArticle?: number;focusRow?: boolean;}) => {- if (!aiAssistantOpen || !desktopColumn || columnWidth <= 0) return false;+ if (!desktopColumn || columnWidth <= 0) return false;if (!Number.isFinite(articleMaxWidth) || articleMaxWidth <= 0) return false;const available = focusRow ? Math.min(columnWidth, EDITOR_FOCUS_ROW_MAX_PX) : columnWidth;return !editorColumnFitsDesktopReadingGutters({