Skip to content

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

Simplify editor reading width and shift outline toggle right

tianma-if6312f1ffc071
diff --git a/apps/web/src/components/EditorOutline.tsx b/apps/web/src/components/EditorOutline.tsx
index c138ca21..94e99a09 100644
--- a/apps/web/src/components/EditorOutline.tsx
+++ b/apps/web/src/components/EditorOutline.tsx
@@ -270,7 +270,7 @@ export const EditorOutline = ({ editor, scrollContainer, collapsed, shortcutLabe
className={cn(
"select-none overflow-x-hidden",
collapsed
- ? "absolute right-2 top-6 z-10 h-8 w-8 overflow-hidden"
+ ? "absolute right-0 top-6 z-10 h-8 w-8 overflow-hidden"
: "sticky top-6 h-fit max-h-[calc(100vh-8rem)] shrink-0 overflow-y-auto py-2"
)}
style={!collapsed ? { width: EDITOR_OUTLINE_WIDTH } : undefined}
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index fd3c90a7..a59b1dd8 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -120,14 +120,13 @@ import { api } from "@/lib/api";
import { isDesktopResourceRuntime, stageDesktopResource, toDesktopResourceDownloadUrl, toDesktopResourceUrl } from "@/lib/desktop-resources";
import { contentReferencesStagedResourceUrl, findMatchingMemoResource, repairMemoStagedResourceUrls, repairTiptapStagedResourceUrls } from "@/lib/staged-resource-repair";
import { cn, parseTagsText } from "@/lib/utils";
-import { editorContentColumnMaxWidth, type EditorContentWidth } from "@/lib/editor-content-width";
import {
EDITOR_ARTICLE_ROW_GAP_PX,
EDITOR_COMPACT_READING_GUTTER,
EDITOR_PANE_TIGHT_PX,
shouldCompactEditorReadingGutter,
} from "@/lib/editor-reading-gutter";
-import { EDITOR_OUTLINE_WIDTH } from "@/lib/workspace-ui";
+import { EDITOR_CONTENT_MAX_WIDTH, EDITOR_OUTLINE_WIDTH } from "@/lib/workspace-ui";
import {
countMemoCharacters,
createEdgeEverDocumentExtensions,
@@ -316,7 +315,6 @@ type EditorPaneProps = {
repository: EdgeEverRepository;
desktopFocusMode: boolean;
onToggleDesktopFocusMode: () => void;
- editorContentWidth: EditorContentWidth;
noteProse: ResolvedNoteProse;
mobileDefaultEditMemoId: string | null;
pendingInsertFiles?: { memoId: string; files: File[] } | null;
@@ -395,7 +393,6 @@ const RichEditorPane = ({
repository,
desktopFocusMode,
onToggleDesktopFocusMode,
- editorContentWidth,
noteProse,
mobileDefaultEditMemoId,
pendingInsertFiles = null,
@@ -3751,9 +3748,6 @@ const RichEditorPane = ({
};
const editorColumnMatchesArticle = !useMarkdownSourceEditor;
- const contentColumnMode = desktopFocusMode ? "focus" : editorOutlineCollapsed ? "collapsed" : "reading";
- const contentColumnMaxWidth = editorContentColumnMaxWidth(editorContentWidth, contentColumnMode);
- const focusTitleMaxWidth = editorContentColumnMaxWidth(editorContentWidth, "focus");
const editorPaneTight = editorColumnWidth > 0 && editorColumnWidth < EDITOR_PANE_TIGHT_PX;
const outlineReservesSpace = !editorPaneTight
&& !isMobileViewport
@@ -3765,7 +3759,7 @@ const RichEditorPane = ({
aiAssistantOpen,
desktopColumn: isDesktopColumn,
columnWidth: Math.max(0, editorColumnWidth - editorScrollbarGutter * 2),
- articleMaxWidth: Number.parseInt(contentColumnMaxWidth, 10),
+ articleMaxWidth: Number.parseInt(EDITOR_CONTENT_MAX_WIDTH, 10),
reservedBesideArticle: outlineReservesSpace
? Number.parseInt(EDITOR_OUTLINE_WIDTH, 10) + EDITOR_ARTICLE_ROW_GAP_PX
: 0,
@@ -3846,7 +3840,7 @@ const RichEditorPane = ({
isDesktopColumn && desktopFocusMode && "mx-auto",
)}
style={{
- ...(isDesktopColumn && desktopFocusMode ? { maxWidth: focusTitleMaxWidth } : {}),
+ ...(isDesktopColumn && desktopFocusMode ? { maxWidth: EDITOR_CONTENT_MAX_WIDTH } : {}),
...(titleStatusClearancePx > 0 ? { paddingRight: titleStatusClearancePx } : {}),
}}
>
@@ -4309,7 +4303,7 @@ const RichEditorPane = ({
useMarkdownSourceEditor && "flex h-full min-h-0 flex-col",
isDesktopColumn && "mx-auto",
)}
- style={isDesktopColumn ? { maxWidth: contentColumnMaxWidth } : undefined}
+ style={isDesktopColumn ? { maxWidth: EDITOR_CONTENT_MAX_WIDTH } : undefined}
>
{useMobilePlainTextEditor ? (
<>
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index 405679f0..e9d6e263 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -22,7 +22,6 @@ import * as m from "motion/react-m";
import { Button } from "@/components/ui/button";
import type { ShortcutSettings } from "@/lib/app-helpers";
-import type { EditorContentWidth } from "@/lib/editor-content-width";
import type { NoteProsePatch, ResolvedNoteProse } from "@edgeever/shared";
import { BETA_BADGE_CLASSNAME, WORKSPACE_PAGE_TITLE_CLASSNAME } from "@/lib/workspace-ui";
import { cn } from "@/lib/utils";
@@ -57,8 +56,6 @@ interface SettingsPaneProps {
onImageCompressionChange: (enabled: boolean) => void;
shortcutSettings: ShortcutSettings;
onShortcutSettingsChange: (settings: ShortcutSettings) => void;
- editorContentWidth: EditorContentWidth;
- onEditorContentWidthChange: (width: EditorContentWidth) => void;
noteProse: ResolvedNoteProse;
onNoteProseChange: (patch: NoteProsePatch) => void;
onLogout: () => void;
@@ -96,8 +93,6 @@ export const SettingsPane = ({
onImageCompressionChange,
shortcutSettings,
onShortcutSettingsChange,
- editorContentWidth,
- onEditorContentWidthChange,
noteProse,
onNoteProseChange,
onLogout,
@@ -221,8 +216,6 @@ export const SettingsPane = ({
<PreferenceCard
imageCompressionEnabled={imageCompressionEnabled}
onImageCompressionChange={onImageCompressionChange}
- editorContentWidth={editorContentWidth}
- onEditorContentWidthChange={onEditorContentWidthChange}
noteProse={noteProse}
onNoteProseChange={onNoteProseChange}
/>
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 4a91672e..dddd6443 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -494,13 +494,11 @@ export const WorkspaceApp = ({
const [multiSelectKeyDown, setMultiSelectKeyDown] = useState(false);
const {
desktopFocusMode,
- editorContentWidth,
imageCompressionEnabled,
memoListWidth,
notebookSidebarCollapsed,
resetMemoListWidth,
setDesktopFocusMode,
- setEditorContentWidth,
setImageCompressionEnabled,
setMemoListWidth,
setNotebookSidebarCollapsed,
@@ -3296,8 +3294,6 @@ export const WorkspaceApp = ({
onImageCompressionChange={setImageCompressionEnabled}
shortcutSettings={shortcutSettings}
onShortcutSettingsChange={setShortcutSettings}
- editorContentWidth={editorContentWidth}
- onEditorContentWidthChange={setEditorContentWidth}
noteProse={noteProse}
onNoteProseChange={updateNoteProse}
onLogout={onLogout}
@@ -3479,7 +3475,6 @@ export const WorkspaceApp = ({
onOpenCompanionNote={handleOpenPluginNote}
desktopFocusMode={desktopFocusModeActive}
onToggleDesktopFocusMode={toggleDesktopFocusMode}
- editorContentWidth={editorContentWidth}
noteProse={noteProse}
mobileDefaultEditMemoId={createdMemoEditId}
isTrashView={memoView === "trash"}
diff --git a/apps/web/src/components/settings/PreferenceCard.test.mjs b/apps/web/src/components/settings/PreferenceCard.test.mjs
index 6396294d..473205fb 100644
--- a/apps/web/src/components/settings/PreferenceCard.test.mjs
+++ b/apps/web/src/components/settings/PreferenceCard.test.mjs
@@ -36,22 +36,6 @@ describe("editor body font preference", () => {
});
});
-describe("editor content width preference", () => {
- test("is a device-local reading setting instead of a per-note toolbar control", () => {
- const preferenceCard = readFileSync(new URL("./PreferenceCard.tsx", import.meta.url), "utf8");
- const editorPane = readFileSync(new URL("../EditorPane.tsx", import.meta.url), "utf8");
-
- expect(preferenceCard).toContain('t("settings.editorContentWidthTitle")');
- expect(preferenceCard).not.toContain('t("settings.editorContentWidthDescription")');
- expect(preferenceCard).toContain("onEditorContentWidthChange(value as EditorContentWidth)");
- expect(preferenceCard).toContain('hidden min-h-16 flex-col');
- expect(preferenceCard).toContain("lg:flex");
- expect(editorPane).toContain('window.matchMedia("(min-width: 1024px)")');
- expect(editorPane).toContain("editorContentColumnMaxWidth");
- expect(editorPane).not.toContain("onToggleEditorContentAlignment");
- });
-});
-
describe("appearance preference", () => {
test("exposes light, dark, and system as a first-class setting", () => {
const preferenceCard = readFileSync(new URL("./PreferenceCard.tsx", import.meta.url), "utf8");
@@ -73,7 +57,6 @@ describe("reading typography settings", () => {
expect(preferenceCard).not.toContain('t("settings.editorBodyFontSizeDescription")');
expect(preferenceCard).toContain('t("settings.editorBodyLineHeightTitle")');
expect(preferenceCard).not.toContain('t("settings.editorBodyLineHeightDescription")');
- expect(preferenceCard).not.toContain('t("settings.editorContentWidthDescription")');
expect(preferenceCard).toContain('t("settings.editorBodyPaletteTitle")');
expect(preferenceCard).toContain("NoteProsePaletteSwatch");
expect(preferenceCard).toContain("NOTE_PROSE_PALETTES[paletteId].accent");
diff --git a/apps/web/src/components/settings/PreferenceCard.tsx b/apps/web/src/components/settings/PreferenceCard.tsx
index 04d0659f..56aa7122 100644
--- a/apps/web/src/components/settings/PreferenceCard.tsx
+++ b/apps/web/src/components/settings/PreferenceCard.tsx
@@ -1,7 +1,6 @@
-import { AlignHorizontalJustifyCenter, AlignVerticalSpaceAround, AppWindow, BookOpenText, ChartNoAxesCombined, Code2, Image, Keyboard, Languages, ListTree, MousePointerClick, Palette, Sparkles, SpellCheck, SunMoon, Type } from "lucide-react";
+import { AlignVerticalSpaceAround, AppWindow, BookOpenText, ChartNoAxesCombined, Code2, Image, Keyboard, Languages, ListTree, MousePointerClick, Palette, Sparkles, SpellCheck, SunMoon, Type } from "lucide-react";
import { useState, useEffect, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
-import type { EditorContentWidth } from "@/lib/editor-content-width";
import type { NoteProsePatch, NoteProsePaletteChoice, ResolvedNoteProse } from "@edgeever/shared";
import { DEFAULT_NOTE_PROSE_CSS, MAX_NOTE_PROSE_CSS_BYTES, NOTE_PROSE_FONT_SIZES, NOTE_PROSE_PALETTE_CHOICES, NOTE_PROSE_PALETTES, noteProseCssDropsDeclarations } from "@edgeever/shared";
import {
@@ -201,8 +200,6 @@ const NOTE_PROSE_LINE_HEIGHT_OPTIONS = [
interface PreferenceCardProps {
imageCompressionEnabled: boolean;
onImageCompressionChange: (enabled: boolean) => void;
- editorContentWidth: EditorContentWidth;
- onEditorContentWidthChange: (width: EditorContentWidth) => void;
noteProse: ResolvedNoteProse;
onNoteProseChange: (patch: NoteProsePatch) => void;
}
@@ -210,8 +207,6 @@ interface PreferenceCardProps {
export const PreferenceCard = ({
imageCompressionEnabled,
onImageCompressionChange,
- editorContentWidth,
- onEditorContentWidthChange,
noteProse,
onNoteProseChange,
}: PreferenceCardProps) => {
@@ -423,29 +418,6 @@ export const PreferenceCard = ({
</PreferenceSection>
<PreferenceSection title={t("settings.groups.reading")}>
- <div className="hidden min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4 lg:flex">
- <div className="flex min-w-0 items-center gap-3">
- <AlignHorizontalJustifyCenter className="h-4 w-4 shrink-0 text-slate-500" />
- <div className="min-w-0">
- <div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorContentWidthTitle")}</div>
- </div>
- </div>
- <div className="w-full shrink-0 sm:w-80">
- <Select
- value={editorContentWidth}
- onValueChange={(value) => onEditorContentWidthChange(value as EditorContentWidth)}
- >
- <SelectTrigger aria-label={t("settings.editorContentWidthTitle")} className="h-9 bg-card">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="standard">{t("settings.editorContentWidths.standard")}</SelectItem>
- <SelectItem value="wide">{t("settings.editorContentWidths.wide")}</SelectItem>
- </SelectContent>
- </Select>
- </div>
- </div>
-
<div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
<div className="flex min-w-0 items-center gap-3">
<BookOpenText className="h-4 w-4 shrink-0 text-slate-500" />
diff --git a/apps/web/src/hooks/useWorkspacePreferences.ts b/apps/web/src/hooks/useWorkspacePreferences.ts
index 8403862e..f3629a07 100644
--- a/apps/web/src/hooks/useWorkspacePreferences.ts
+++ b/apps/web/src/hooks/useWorkspacePreferences.ts
@@ -14,17 +14,11 @@ import {
writeShortcutSettingsPreference,
type ShortcutSettings,
} from "@/lib/app-helpers";
-import {
- readEditorContentWidthPreference,
- writeEditorContentWidthPreference,
- type EditorContentWidth,
-} from "@/lib/editor-content-width";
export const useWorkspacePreferences = () => {
const [imageCompressionEnabled, setImageCompressionEnabled] = useState(readImageCompressionPreference);
const [desktopFocusMode, setDesktopFocusModeState] = useState(readDesktopFocusModePreference);
const [notebookSidebarCollapsed, setNotebookSidebarCollapsedState] = useState(readNotebookSidebarCollapsedPreference);
- const [editorContentWidth, setEditorContentWidthState] = useState(readEditorContentWidthPreference);
const [shortcutSettings, setShortcutSettings] = useState<ShortcutSettings>(readShortcutSettingsPreference);
const [memoListWidth, setMemoListWidthState] = useState(readMemoListWidthPreference);
@@ -41,11 +35,6 @@ export const useWorkspacePreferences = () => {
writeNotebookSidebarCollapsedPreference(collapsed);
}, []);
- const setEditorContentWidth = useCallback((width: EditorContentWidth) => {
- setEditorContentWidthState(width);
- writeEditorContentWidthPreference(width);
- }, []);
-
const setMemoListWidth = useCallback((width: number) => {
const nextWidth = clampMemoListWidth(width);
setMemoListWidthState(nextWidth);
@@ -58,13 +47,11 @@ export const useWorkspacePreferences = () => {
return {
desktopFocusMode,
- editorContentWidth,
imageCompressionEnabled,
memoListWidth,
notebookSidebarCollapsed,
resetMemoListWidth,
setDesktopFocusMode,
- setEditorContentWidth,
setNotebookSidebarCollapsed,
setImageCompressionEnabled,
setMemoListWidth,
diff --git a/apps/web/src/lib/editor-content-width.test.mjs b/apps/web/src/lib/editor-content-width.test.mjs
deleted file mode 100644
index c9330b02..00000000
--- a/apps/web/src/lib/editor-content-width.test.mjs
+++ /dev/null
@@ -1,21 +0,0 @@
-import { describe, expect, test } from "bun:test";
-import { editorContentColumnMaxWidth, editorContentWidthFromStored } from "./editor-content-width.ts";
-
-describe("editor content width", () => {
- test("keeps an explicit width and treats only the old left alignment as wider", () => {
- expect(editorContentWidthFromStored(null, null)).toBe("standard");
- expect(editorContentWidthFromStored(null, "center")).toBe("standard");
- expect(editorContentWidthFromStored(undefined, "start")).toBe("wide");
- expect(editorContentWidthFromStored("wide", "center")).toBe("wide");
- expect(editorContentWidthFromStored("standard", "start")).toBe("standard");
- });
-
- test("uses the two centered column widths", () => {
- expect(editorContentColumnMaxWidth("standard", "reading")).toBe("880px");
- expect(editorContentColumnMaxWidth("standard", "collapsed")).toBe("1200px");
- expect(editorContentColumnMaxWidth("standard", "focus")).toBe("960px");
- expect(editorContentColumnMaxWidth("wide", "reading")).toBe("1040px");
- expect(editorContentColumnMaxWidth("wide", "collapsed")).toBe("1280px");
- expect(editorContentColumnMaxWidth("wide", "focus")).toBe("1120px");
- });
-});
diff --git a/apps/web/src/lib/editor-content-width.ts b/apps/web/src/lib/editor-content-width.ts
deleted file mode 100644
index e1ec429d..00000000
--- a/apps/web/src/lib/editor-content-width.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-export type EditorContentWidth = "standard" | "wide";
-
-export const EDITOR_CONTENT_WIDTH_STORAGE_KEY = "edgeever.editorContentWidth";
-export const EDITOR_CONTENT_ALIGNMENT_STORAGE_KEY = "edgeever.editorContentAlignment";
-
-const EDITOR_CONTENT_COLUMN_WIDTHS = {
- standard: { reading: "880px", collapsed: "1200px", focus: "960px" },
- wide: { reading: "1040px", collapsed: "1280px", focus: "1120px" },
-} as const;
-
-export type EditorContentColumnMode = keyof (typeof EDITOR_CONTENT_COLUMN_WIDTHS)["standard"];
-
-export const editorContentWidthFromStored = (
- width: string | null | undefined,
- legacyAlignment: string | null | undefined,
-): EditorContentWidth => {
- if (width === "standard" || width === "wide") return width;
- return legacyAlignment === "start" ? "wide" : "standard";
-};
-
-export const editorContentColumnMaxWidth = (
- width: EditorContentWidth,
- mode: EditorContentColumnMode,
-) => EDITOR_CONTENT_COLUMN_WIDTHS[width][mode];
-
-const readStorage = (key: string) => {
- if (typeof window === "undefined") return null;
- try {
- return window.localStorage.getItem(key);
- } catch {
- return null;
- }
-};
-
-export const readEditorContentWidthPreference = (): EditorContentWidth =>
- editorContentWidthFromStored(
- readStorage(EDITOR_CONTENT_WIDTH_STORAGE_KEY),
- readStorage(EDITOR_CONTENT_ALIGNMENT_STORAGE_KEY),
- );
-
-export const writeEditorContentWidthPreference = (width: EditorContentWidth) => {
- if (typeof window === "undefined") return;
- try {
- window.localStorage.setItem(EDITOR_CONTENT_WIDTH_STORAGE_KEY, width);
- } catch {
- // Local storage can be unavailable in private or restricted browser contexts.
- }
-};
diff --git a/apps/web/src/lib/workspace-ui.ts b/apps/web/src/lib/workspace-ui.ts
index f5c04158..688ef0a8 100644
--- a/apps/web/src/lib/workspace-ui.ts
+++ b/apps/web/src/lib/workspace-ui.ts
@@ -11,4 +11,3 @@ export const BETA_BADGE_CLASSNAME =
*/
export const EDITOR_OUTLINE_WIDTH = "300px";
export const EDITOR_CONTENT_MAX_WIDTH = "880px";
-export const EDITOR_CONTENT_MAX_WIDTH_COLLAPSED = "1200px";
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 960d5a37..8da3980f 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -795,12 +795,6 @@ export const enUS = {
center: "Optimize readability (centered)",
start: "Align left",
},
- editorContentWidthTitle: "Text width",
- editorContentWidthDescription: "Changes the editor width on this device only.",
- editorContentWidths: {
- standard: "Standard",
- wide: "Wider",
- },
editorBodyFontSizeTitle: "Text size",
editorBodyLineHeightTitle: "Line height",
accountSyncDescription: "Syncs to the cloud.",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index 93f8f69f..479211f2 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -795,12 +795,6 @@ export const ja = {
center: "読みやすさを優先(中央)",
start: "左揃え",
},
- editorContentWidthTitle: "本文の幅",
- editorContentWidthDescription: "この端末の編集領域だけを変えます。",
- editorContentWidths: {
- standard: "標準",
- wide: "広め",
- },
editorBodyFontSizeTitle: "本文の文字サイズ",
editorBodyLineHeightTitle: "行間",
accountSyncDescription: "クラウドに同期します。",
diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.ts
index fbd89ba7..e8528307 100644
--- a/packages/shared/src/i18n/pl.ts
+++ b/packages/shared/src/i18n/pl.ts
@@ -795,12 +795,6 @@ export const pl = {
center: "Optymalna czytelność (wyśrodkowanie)",
start: "Wyrównaj do lewej",
},
- editorContentWidthTitle: "Szerokość tekstu",
- editorContentWidthDescription: "Zmienia szerokość edytora tylko na tym urządzeniu.",
- editorContentWidths: {
- standard: "Standardowa",
- wide: "Szersza",
- },
editorBodyFontSizeTitle: "Rozmiar tekstu",
editorBodyLineHeightTitle: "Interlinia",
accountSyncDescription: "Synchronizowane z chmurą.",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 25dc1d6d..f593a235 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -795,12 +795,6 @@ export const zhCN = {
center: "优化可读性(居中)",
start: "靠左显示",
},
- editorContentWidthTitle: "正文宽度",
- editorContentWidthDescription: "只改变这台设备上的编辑区。",
- editorContentWidths: {
- standard: "标准",
- wide: "较宽",
- },
editorBodyFontSizeTitle: "正文字号",
editorBodyLineHeightTitle: "行高",
accountSyncDescription: "支持云端同步。",