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): remove the custom note palette

tianma-if16205e0173e4
diff --git a/apps/web/src/components/settings/PreferenceCard.test.mjs b/apps/web/src/components/settings/PreferenceCard.test.mjs
index 2ac172dc..0a816c57 100644
--- a/apps/web/src/components/settings/PreferenceCard.test.mjs
+++ b/apps/web/src/components/settings/PreferenceCard.test.mjs
@@ -70,12 +70,14 @@ describe("reading typography settings", () => {
const editorToolbar = readFileSync(new URL("../EditorToolbar.tsx", import.meta.url), "utf8");
expect(preferenceCard).toContain('t("settings.editorBodyFontSizeTitle")');
- expect(preferenceCard).toContain('t("settings.editorBodyFontSizeDescription")');
+ expect(preferenceCard).not.toContain('t("settings.editorBodyFontSizeDescription")');
expect(preferenceCard).toContain('t("settings.editorBodyLineHeightTitle")');
- expect(preferenceCard).toContain('t("settings.editorBodyLineHeightDescription")');
+ expect(preferenceCard).not.toContain('t("settings.editorBodyLineHeightDescription")');
+ expect(preferenceCard).toContain('t("settings.editorContentWidthDescription")');
expect(preferenceCard).toContain('t("settings.editorBodyPaletteTitle")');
expect(preferenceCard).toContain('t("settings.editorBodyCssTitle")');
expect(preferenceCard).toContain('t("settings.editorBodyCssDescription")');
+ expect(preferenceCard.match(/t\("settings\.accountSyncDescription"\)/g)).toHaveLength(1);
expect(preferenceCard).toContain("NoteProseCssEditor");
expect(readFileSync(new URL("./NoteProseCssEditor.tsx", import.meta.url), "utf8")).toContain("@codemirror/lang-css");
expect(preferenceCard).toContain('t("common.save")');
diff --git a/apps/web/src/components/settings/PreferenceCard.tsx b/apps/web/src/components/settings/PreferenceCard.tsx
index 8485cfac..21e6d4d1 100644
--- a/apps/web/src/components/settings/PreferenceCard.tsx
+++ b/apps/web/src/components/settings/PreferenceCard.tsx
@@ -43,7 +43,6 @@ import {
} from "@/lib/editor-body-font";
import { applyUiFontPreference, readUiFontPreference, writeUiFontPreference } from "@/lib/ui-font";
import { syncPublishedNoteBodyFont } from "@/lib/published-note-body-font";
-import { CustomEditorThemeDialog } from "./CustomEditorThemeDialog";
import { NoteProseCssEditor } from "./NoteProseCssEditor";
const PreferenceSection = ({ title, children }: { title: string; children: ReactNode }) => (
@@ -57,11 +56,7 @@ const PreferenceSection = ({ title, children }: { title: string; children: React
import {
MERMAID_THEME_PREFERENCES,
useAppearanceTheme,
- useEditorTheme,
useMermaidTheme,
- DEFAULT_CUSTOM_LIGHT_COLORS,
- DEFAULT_CUSTOM_DARK_COLORS,
- type CustomEditorTheme,
type ThemePreference,
} from "../ThemeProvider";
@@ -205,34 +200,17 @@ export const PreferenceCard = ({
onNoteProseChange,
}: PreferenceCardProps) => {
const { t } = useTranslation();
- const {
- editorTheme,
- customEditorThemes,
- setCustomEditorThemes,
- setEditorTheme,
- } = useEditorTheme();
const { preference: appearancePreference, resolvedTheme, setPreference: setAppearancePreference } = useAppearanceTheme();
const { mermaidThemePreference, setMermaidTheme } = useMermaidTheme();
- const [customThemeDialogOpen, setCustomThemeDialogOpen] = useState(false);
const [cssDialogOpen, setCssDialogOpen] = useState(false);
const [cssDraft, setCssDraft] = useState(noteProse.customCss);
- const [editingTheme, setEditingTheme] = useState<CustomEditorTheme | null>(null);
const [activeLocalePreference, setActiveLocalePreference] = useState<AppLocalePreference>(() => getAppLocalePreference());
- const [isMobile, setIsMobile] = useState(false);
const [linkOpenMode, setLinkOpenMode] = useState<EditorLinkOpenMode>(() => getStoredEditorLinkOpenMode());
const [aiSelectionMenuEnabled, setAiSelectionMenuEnabled] = useState(readAiSelectionMenuPreference);
const [aiSpaceShortcutEnabled, setAiSpaceShortcutEnabled] = useState(readAiSpaceShortcutPreference);
const [editorBodyFont, setEditorBodyFont] = useState(readEditorBodyFontPreference);
const [uiFont, setUiFont] = useState(readUiFontPreference);
- useEffect(() => {
- const mediaQuery = window.matchMedia("(max-width: 640px)");
- setIsMobile(mediaQuery.matches);
- const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);
- mediaQuery.addEventListener("change", handler);
- return () => mediaQuery.removeEventListener("change", handler);
- }, []);
-
useEffect(() => {
const syncPreference = () => setAiSpaceShortcutEnabled(readAiSpaceShortcutPreference());
const onPreferenceChanged = (event: Event) => {
@@ -289,31 +267,6 @@ export const PreferenceCard = ({
const cssDraftBytes = new TextEncoder().encode(cssDraft).byteLength;
- const handleEditClick = () => {
- const colors = noteProse.customColors;
- setEditingTheme({
- id: "account-custom",
- name: t("settings.customEditorTheme.defaultName"),
- light: colors?.light ?? DEFAULT_CUSTOM_LIGHT_COLORS,
- dark: colors?.dark ?? DEFAULT_CUSTOM_DARK_COLORS,
- customCss: noteProse.customCss,
- });
- setCustomThemeDialogOpen(true);
- };
-
- const handleSaveTheme = (saved: CustomEditorTheme) => {
- const exists = customEditorThemes.some((theme) => theme.id === saved.id);
- const nextThemes = exists
- ? customEditorThemes.map((theme) => (theme.id === saved.id ? saved : theme))
- : [...customEditorThemes, saved];
- setCustomEditorThemes(nextThemes);
- onNoteProseChange({
- palette: "custom",
- customColors: { light: saved.light, dark: saved.dark },
- ...(saved.customCss?.trim() ? { customCss: saved.customCss } : {}),
- });
- };
-
const openCssDialog = () => {
setCssDraft(noteProse.customCss);
setCssDialogOpen(true);
@@ -324,14 +277,6 @@ export const PreferenceCard = ({
setCssDialogOpen(false);
};
- const handleDeleteTheme = (idToDelete: string) => {
- const nextThemes = customEditorThemes.filter((t) => t.id !== idToDelete);
- setCustomEditorThemes(nextThemes);
- if (editorTheme === idToDelete) {
- setEditorTheme("default");
- }
- };
-
const handleLocalePreferenceChange = (preference: AppLocalePreference) => {
setActiveLocalePreference(preference);
void changeAppLocalePreference(preference);
@@ -463,7 +408,6 @@ export const PreferenceCard = ({
<Type className="h-4 w-4 shrink-0 text-slate-500" />
<div className="min-w-0">
<div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyFontSizeTitle")}</div>
- <p className="text-xs leading-5 text-slate-500">{t("settings.editorBodyFontSizeDescription")}</p>
</div>
</div>
<div className="w-full shrink-0 sm:w-80">
@@ -488,7 +432,6 @@ export const PreferenceCard = ({
<AlignVerticalSpaceAround className="h-4 w-4 shrink-0 text-slate-500" />
<div className="min-w-0">
<div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyLineHeightTitle")}</div>
- <p className="text-xs leading-5 text-slate-500">{t("settings.editorBodyLineHeightDescription")}</p>
</div>
</div>
<div className="w-full shrink-0 sm:w-80">
@@ -529,11 +472,6 @@ export const PreferenceCard = ({
))}
</SelectContent>
</Select>
- {noteProse.palette === "custom" && !isMobile ? (
- <Button variant="outline" className="h-9 shrink-0 px-3 text-xs" onClick={handleEditClick}>
- {t("settings.customEditorTheme.edit")}
- </Button>
- ) : null}
</div>
</div>
@@ -542,7 +480,7 @@ export const PreferenceCard = ({
<Code2 className="h-4 w-4 shrink-0 text-slate-500" />
<div className="min-w-0">
<div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyCssTitle")}</div>
- <p className="text-xs leading-5 text-slate-500">{t("settings.editorBodyCssDescription")}</p>
+ <p className="text-xs leading-5 text-slate-500">{t("settings.accountSyncDescription")}</p>
</div>
</div>
<div className="w-full shrink-0 sm:w-auto">
@@ -652,16 +590,6 @@ export const PreferenceCard = ({
</div>
</div>
</PreferenceSection>
- {!isMobile && editingTheme && (
- <CustomEditorThemeDialog
- open={customThemeDialogOpen}
- theme={editingTheme}
- onOpenChange={setCustomThemeDialogOpen}
- onSave={handleSaveTheme}
- onDelete={handleDeleteTheme}
- isDefaultTheme={editingTheme.id === "custom-default"}
- />
- )}
<Dialog open={cssDialogOpen} onOpenChange={setCssDialogOpen}>
<DialogContent>
<DialogHeader>
diff --git a/apps/web/src/lib/note-prose-local.ts b/apps/web/src/lib/note-prose-local.ts
index c98c1f87..7bcd0f8b 100644
--- a/apps/web/src/lib/note-prose-local.ts
+++ b/apps/web/src/lib/note-prose-local.ts
@@ -1,6 +1,5 @@
import {
paletteForLegacyEditorTheme,
- parseNoteProseCustomColors,
type NoteProseCustomColors,
type NoteProsePaletteChoice,
} from "@edgeever/shared";
@@ -27,7 +26,6 @@ export const readLocalNoteProseMigration = (): LocalNoteProseMigration => {
const theme = readStorage(EDITOR_THEME_STORAGE_KEY);
const palette = paletteForLegacyEditorTheme(theme);
let customCss: string | null = null;
- let customColors: NoteProseCustomColors | null = null;
const rawThemes = readStorage(CUSTOM_EDITOR_THEMES_STORAGE_KEY);
if (rawThemes) {
try {
@@ -41,20 +39,10 @@ export const readLocalNoteProseMigration = (): LocalNoteProseMigration => {
&& typeof (item as { customCss?: unknown }).customCss === "string"
&& (item as { customCss: string }).customCss.trim());
if (cssOwner) customCss = (cssOwner as { customCss: string }).customCss;
- if (palette === "custom") {
- const colorOwner = selected ?? parsed[0];
- if (typeof colorOwner === "object" && colorOwner !== null) {
- customColors = parseNoteProseCustomColors({
- light: (colorOwner as { light?: unknown }).light,
- dark: (colorOwner as { dark?: unknown }).dark,
- });
- }
- }
}
} catch {
customCss = null;
- customColors = null;
}
}
- return { palette, customCss, customColors };
+ return { palette, customCss, customColors: null };
};
diff --git a/apps/web/src/lib/publish-layout.test.mjs b/apps/web/src/lib/publish-layout.test.mjs
index 2b0c2d27..01eaad0a 100644
--- a/apps/web/src/lib/publish-layout.test.mjs
+++ b/apps/web/src/lib/publish-layout.test.mjs
@@ -220,7 +220,8 @@ describe("copy pipeline wiring", () => {
expect(source).toContain("applyLegacyWeChatStyles");
expect(source).toContain("const bold = colors ? `font-weight: 700; color: ${accent};` : \"font-weight: 700;\"");
expect(source).toContain("accentOnly");
- expect(source).toContain('palette !== "custom"');
+ expect(source).toContain('palette !== "native"');
+ expect(source).not.toContain('palette !== "custom"');
expect(preview).toContain("preparePublishArticle(editor.getHTML(), editor.view.dom)");
expect(preview).toContain("previewRef.current?.setAttribute(\"style\", markup.style)");
expect(preview).toContain("noteProse");
diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts
index ed79733f..fb551420 100644
--- a/apps/web/src/lib/wechat-copy.ts
+++ b/apps/web/src/lib/wechat-copy.ts
@@ -45,7 +45,7 @@ const applyLegacyWeChatStyles = (
const fontSize = `${metrics.fontSize}px`;
const lineHeight = String(metrics.lineHeight);
const codeSize = `${noteProseCodeFontSize(metrics.fontSize)}px`;
- // Named hues move link, inline-code, and bold ink. Custom still paints the whole article.
+ // Named hues move link, inline-code, and bold ink. The rest stays on the WeChat defaults.
const painted = accentOnly ? null : colors;
const text = painted?.text ?? "#333";
const headingColor = painted?.text ?? "#1f2937";
@@ -508,7 +508,7 @@ export const readEditorCopyContext = (from?: HTMLElement | null) => {
fontSize,
lineHeight,
colors,
- accentOnly: Boolean(palette && palette !== "native" && palette !== "custom"),
+ accentOnly: Boolean(palette && palette !== "native"),
customCss: customStyleTag?.dataset.originalCss || "",
};
};
diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs
index aac960b4..209006c7 100644
--- a/apps/web/src/styles/editor-typography.test.mjs
+++ b/apps/web/src/styles/editor-typography.test.mjs
@@ -77,23 +77,23 @@ describe("editor typography contract", () => {
const boldRules = declarationsForSelector(prose, ".ProseMirror strong");
expect(boldRules).toMatch(/color:\s*var\(--note-palette-accent\)/);
- expect(boldRules).toMatch(/color:\s*var\(--note-palette-dark-accent\)/);
+ expect(prose).not.toMatch(/--note-palette-dark-accent/);
+ expect(prose).not.toContain('data-note-palette="custom"');
});
test("named palettes recolor links, inline code, and bold", () => {
const prose = readStyle("./note-prose.css");
- const named = prose.split('.edgeever-editor[data-note-palette="custom"]')[0];
-
- expect(named).toMatch(/color:\s*var\(--note-palette-link\)/);
- expect(named).toMatch(/color:\s*var\(--note-palette-code-text\)/);
- expect(named).toMatch(/color:\s*var\(--note-palette-accent\)/);
- expect(named).toMatch(/\.edgeever-code-block code/);
- expect(named).not.toMatch(/--note-palette-text/);
- expect(named).not.toMatch(/--note-palette-surface/);
- expect(named).not.toMatch(/--note-palette-muted/);
- expect(named).not.toMatch(/--note-palette-divider/);
- expect(named).not.toMatch(/--note-palette-code-bg/);
- expect(named).not.toMatch(/blockquote/);
+
+ expect(prose).toMatch(/color:\s*var\(--note-palette-link\)/);
+ expect(prose).toMatch(/color:\s*var\(--note-palette-code-text\)/);
+ expect(prose).toMatch(/color:\s*var\(--note-palette-accent\)/);
+ expect(prose).toMatch(/\.edgeever-code-block code/);
+ expect(prose).not.toMatch(/--note-palette-text/);
+ expect(prose).not.toMatch(/--note-palette-surface/);
+ expect(prose).not.toMatch(/--note-palette-muted/);
+ expect(prose).not.toMatch(/--note-palette-divider/);
+ expect(prose).not.toMatch(/--note-palette-code-bg/);
+ expect(prose).not.toMatch(/blockquote/);
});
test("keeps bold and italic text visible across platform font fallbacks", () => {
diff --git a/apps/web/src/styles/note-prose.css b/apps/web/src/styles/note-prose.css
index 6a39dcd1..59a9e39a 100644
--- a/apps/web/src/styles/note-prose.css
+++ b/apps/web/src/styles/note-prose.css
@@ -1,123 +1,44 @@
/* Named hues tint links, inline code, and bold. Body, quotes, rules, tables, and code chrome stay native. */
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link) {
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror a:not(.edgeever-attachment-link) {
color: var(--note-palette-link);
text-decoration-color: color-mix(in srgb, var(--note-palette-link) 45%, transparent);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
color: var(--note-palette-link);
text-decoration-color: var(--note-palette-link);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror strong,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror b {
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror b {
color: var(--note-palette-accent);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror code {
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code {
color: var(--note-palette-code-text);
}
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror pre code,
-.edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror .edgeever-code-block code {
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror pre code,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror .edgeever-code-block code {
color: inherit;
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link) {
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror a:not(.edgeever-attachment-link) {
color: var(--note-palette-accent);
text-decoration-color: color-mix(in srgb, var(--note-palette-accent) 45%, transparent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror a:not(.edgeever-attachment-link):hover {
color: var(--note-palette-accent);
text-decoration-color: var(--note-palette-accent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror code {
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror code {
color: var(--note-palette-accent);
}
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror pre code,
-:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]):not([data-note-palette="custom"]) .ProseMirror .edgeever-code-block code {
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror pre code,
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror .edgeever-code-block code {
color: inherit;
}
-.edgeever-editor[data-note-palette="custom"] .ProseMirror {
- color: var(--note-palette-text);
- background: var(--note-palette-bg);
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h1,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h2,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h3,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h4,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h5,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror h6 {
- color: var(--note-palette-heading, var(--note-palette-text));
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror a:not(.edgeever-attachment-link) {
- color: var(--note-palette-link);
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror strong,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror b {
- color: var(--note-palette-accent);
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror blockquote {
- background: var(--note-palette-surface);
- color: var(--note-palette-muted);
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror hr,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror td,
-.edgeever-editor[data-note-palette="custom"] .ProseMirror th {
- border-color: var(--note-palette-divider);
-}
-
-.edgeever-editor[data-note-palette="custom"] .ProseMirror code {
- background: var(--note-palette-code-bg);
- color: var(--note-palette-code-text);
- border-color: var(--note-palette-divider);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror {
- color: var(--note-palette-dark-text);
- background: var(--note-palette-dark-bg);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h1,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h2,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h3,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h4,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h5,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror h6 {
- color: var(--note-palette-dark-heading, var(--note-palette-dark-text));
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror a:not(.edgeever-attachment-link) {
- color: var(--note-palette-dark-link);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror strong,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror b {
- color: var(--note-palette-dark-accent);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror blockquote {
- background: var(--note-palette-dark-surface);
- color: var(--note-palette-dark-muted);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror hr,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror td,
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror th {
- border-color: var(--note-palette-dark-divider);
-}
-
-:root.dark .edgeever-editor[data-note-palette="custom"] .ProseMirror code {
- background: var(--note-palette-dark-code-bg);
- color: var(--note-palette-dark-code-text);
- border-color: var(--note-palette-dark-divider);
-}
diff --git a/docs/editor-typography-plan.zh-CN.md b/docs/editor-typography-plan.zh-CN.md
index a5bd41d7..9f294b85 100644
--- a/docs/editor-typography-plan.zh-CN.md
+++ b/docs/editor-typography-plan.zh-CN.md
@@ -11,7 +11,7 @@
版式附带的装饰一起去掉,包括章节编号(如「NO. 01」)、标题装饰线、刊头文字和特定引用样式。笔记正文本身不变。
-本机如果存过上述主题(`edgeever.editor-theme`),版式装饰不再套用。颜色按「字体和颜色」里的表迁到对应配色。存过的自定义配色继续生效。
+本机如果存过上述主题(`edgeever.editor-theme`),版式装饰不再套用。颜色按「字体和颜色」里的表迁到对应配色。存过的自定义配色按原生处理。
## 阅读设置
@@ -23,9 +23,9 @@
| 笔记正文字体 | 保持现有列表:跟随系统、霞鹜文楷、霞鹜文楷屏幕版、朱雀仿宋、思源宋体、霞鹜新致宋、思源黑体、西文衬线、自定义 | 跟随系统 |
| 正文字号 | 14、16、18、20 | 16 |
| 行高 | 紧凑 1.5、标准 1.65、宽松 2.0 | 标准 |
-| 正文配色 | 原生,加上下面 9 款;另有自定义 | 原生 |
+| 正文配色 | 原生,加上下面 9 款 | 原生 |
-字号、行高、栏宽用固定档位,不用滑杆。正文字号和行高的说明各一行:**同时用于编辑器和公开分享。** 正文宽度的说明一行:**只改变这台设备上的编辑区。**
+字号、行高、栏宽用固定档位,不用滑杆。正文字号、行高和正文配色不附说明。自定义 CSS 的说明一行:**支持云端同步。** 正文宽度的说明一行:**只改变这台设备上的编辑区。**
### 正文宽度
@@ -61,7 +61,7 @@
笔记正文字体维持现状:本机选择,内置字体仍可发布到公开分享页,自定义字体名称不发布。
-正文配色放在「阅读」里,用固定选项,不用滑杆。默认是现在的原生配色。另外 9 款按色相分开,每款差一个大色相。浅色沿用现成色板的正文色、弱化色、表面色、分隔线和代码色。深色模式保持现在的深色背景和正文色,强调色跟所选配色走。界面、侧栏、工具栏、图表和信息图不跟着变。
+正文配色放在「阅读」里,用固定选项,不用滑杆。默认是现在的原生配色。另外 9 款按色相分开,每款差一个大色相。选中一款时,只改链接、行内代码和粗体,粗体用该款强调色。正文、标题、引用、分隔线、表格、代码底和代码边框仍用原生。深色模式同样只改这三项,链接和行内代码用强调色。界面、侧栏、工具栏、图表和信息图不跟着变。
原先那 10 款里,琥珀和日暖都是金黄,夜蓝和青页都是蓝,雾色和青玉都是青,林绿又接近品牌绿。这四款舍弃。空出来的位置用酒红,再补色相上没有的橙色和粉色。绿色曾放进选项,后来去掉。设置里的名字直接用色名。
@@ -84,9 +84,7 @@
| 橙色 | `#E07A2D` | `#FFF4EA` | `#3A2E28` | `#B45309` |
| 粉色 | `#D4537E` | `#FDF2F6` | `#3A2E34` | `#BE185D` |
-选「自定义」时,仍用现在的颜色编辑器逐项改。
-
-配色存在账号上,和自定义 CSS 一样。编辑器和这个账号的公开分享都用它。复制到公众号时,文字色、强调色和底色也跟着这款走。
+配色存在账号上,和自定义 CSS 一样。编辑器和这个账号的公开分享都用它。复制到公众号时,链接、行内代码和粗体跟着这款走,其余保持公众号默认。
原先选过某套版式的设备,打开后落到色相最接近的一款:
@@ -100,7 +98,7 @@
| 堇色目录 | 紫色 |
| 铅字期刊 | 灰色 |
| 原生 | 原生 |
-| 已保存的自定义配色 | 自定义 |
+| 已保存的自定义配色 | 原生 |
## 自定义 CSS
@@ -122,7 +120,7 @@
栏宽作用于 Web 和桌面的编辑区,只给作者自己看。分享页保持自己的文章卡片宽度。
-字号和行高作用于 Web、桌面编辑器和公开分享。复制到公众号时,正文带上同一档字号和行高。「复制到公众号 / 博客」不再套用铅字期刊等版式,颜色改跟账号上的配色走。自定义 CSS 里的纯标签规则继续写进复制结果,其中的字号和行高声明被丢掉。
+字号和行高作用于 Web、桌面编辑器和公开分享。复制到公众号时,正文带上同一档字号和行高。「复制到公众号 / 博客」不再套用铅字期刊等版式。链接、行内代码和粗体跟账号上的配色走。自定义 CSS 里的纯标签规则继续写进复制结果,其中的字号和行高声明被丢掉。
iOS 和 Android 的编辑器保持现在的 16px 与对应行高,本轮不改。手机浏览器打开公开分享时,看到的是账号上的字号和行高。
diff --git a/migrations/0059_retire_custom_note_palette.sql b/migrations/0059_retire_custom_note_palette.sql
new file mode 100644
index 00000000..a11b2bb2
--- /dev/null
+++ b/migrations/0059_retire_custom_note_palette.sql
@@ -0,0 +1,3 @@
+UPDATE users
+SET note_prose_palette = 'native'
+WHERE note_prose_palette = 'custom';
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index f1c02d82..3c200d51 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -774,9 +774,8 @@ export const enUS = {
wide: "Wider",
},
editorBodyFontSizeTitle: "Text size",
- editorBodyFontSizeDescription: "Used by the editor and public shares.",
editorBodyLineHeightTitle: "Line height",
- editorBodyLineHeightDescription: "Used by the editor and public shares.",
+ accountSyncDescription: "Syncs to the cloud.",
editorBodyLineHeights: {
compact: "Compact 1.5",
standard: "Standard 1.65",
@@ -794,10 +793,9 @@ export const enUS = {
plum: "Wine",
pink: "Pink",
slate: "Gray",
- custom: "Custom",
},
editorBodyCssTitle: "Custom CSS",
- editorBodyCssDescription: "Used by the editor and public shares. Size and line height stay on the controls above.",
+ editorBodyCssDescription: "Size and line height stay on the controls above.",
editorBodyCssEdit: "Edit styles",
editorBodyCssPlaceholder: "p { text-indent: 2em; } h1 { letter-spacing: 0.04em; }",
editorBodyFontTitle: "Note text font",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index af2630d7..8bf2475c 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -774,9 +774,8 @@ export const ja = {
wide: "広め",
},
editorBodyFontSizeTitle: "本文の文字サイズ",
- editorBodyFontSizeDescription: "エディタと公開共有の両方に使います。",
editorBodyLineHeightTitle: "行間",
- editorBodyLineHeightDescription: "エディタと公開共有の両方に使います。",
+ accountSyncDescription: "クラウドに同期します。",
editorBodyLineHeights: {
compact: "詰め 1.5",
standard: "標準 1.65",
@@ -794,10 +793,9 @@ export const ja = {
plum: "ワイン",
pink: "ピンク",
slate: "グレー",
- custom: "カスタム",
},
editorBodyCssTitle: "カスタム CSS",
- editorBodyCssDescription: "エディタと公開共有の両方に使います。文字サイズと行間はここでは指定しません。",
+ editorBodyCssDescription: "文字サイズと行間はここでは指定しません。",
editorBodyCssEdit: "スタイルを編集",
editorBodyCssPlaceholder: "p { text-indent: 2em; } h1 { letter-spacing: 0.04em; }",
editorBodyFontTitle: "ノート本文のフォント",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 7113b58b..69134d82 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -774,9 +774,8 @@ export const zhCN = {
wide: "较宽",
},
editorBodyFontSizeTitle: "正文字号",
- editorBodyFontSizeDescription: "同时用于编辑器和公开分享。",
editorBodyLineHeightTitle: "行高",
- editorBodyLineHeightDescription: "同时用于编辑器和公开分享。",
+ accountSyncDescription: "支持云端同步。",
editorBodyLineHeights: {
compact: "紧凑 1.5",
standard: "标准 1.65",
@@ -794,10 +793,9 @@ export const zhCN = {
plum: "酒红",
pink: "粉色",
slate: "灰色",
- custom: "自定义",
},
editorBodyCssTitle: "自定义 CSS",
- editorBodyCssDescription: "同时用于编辑器和公开分享。字号和行高不写在这里。",
+ editorBodyCssDescription: "字号和行高不写在这里。",
editorBodyCssEdit: "编辑样式",
editorBodyCssPlaceholder: "例如 p { text-indent: 2em; } h1 { letter-spacing: 0.04em; }",
editorBodyFontTitle: "笔记正文字体",
diff --git a/packages/shared/src/note-prose.test.mjs b/packages/shared/src/note-prose.test.mjs
index 43cc8d76..71fa467c 100644
--- a/packages/shared/src/note-prose.test.mjs
+++ b/packages/shared/src/note-prose.test.mjs
@@ -1,6 +1,5 @@
import { describe, expect, test } from "bun:test";
import {
- DEFAULT_NOTE_PROSE_CUSTOM_COLORS,
MAX_NOTE_PROSE_CSS_BYTES,
NoteProseUpdateSchema,
noteProseCodeFontSize,
@@ -39,7 +38,9 @@ describe("note prose", () => {
expect(paletteForLegacyEditorTheme("journal")).toBe("slate");
expect(paletteForLegacyEditorTheme("default")).toBeNull();
expect(paletteForLegacyEditorTheme("marxico")).toBeNull();
- expect(paletteForLegacyEditorTheme("custom-default")).toBe("custom");
+ expect(paletteForLegacyEditorTheme("custom-default")).toBeNull();
+ expect(parseNoteProsePalette("custom")).toBe("native");
+ expect(resolveNoteProse({ palette: "custom" }).palette).toBe("native");
expect(paletteForLegacyEditorTheme("not-a-theme")).toBeNull();
});
@@ -80,14 +81,11 @@ describe("note prose", () => {
customColors: null,
})).toEqual({});
- const custom = noteProseMigrationPatch(emptyAccount(), {
+ expect(noteProseMigrationPatch(emptyAccount(), {
palette: "custom",
customCss: " ",
customColors: null,
- });
- expect(custom.palette).toBe("custom");
- expect(custom.customCss).toBeUndefined();
- expect(custom.customColors).toEqual(DEFAULT_NOTE_PROSE_CUSTOM_COLORS);
+ })).toEqual({});
});
test("rejects a stylesheet larger than 8 KB", () => {
diff --git a/packages/shared/src/note-prose.ts b/packages/shared/src/note-prose.ts
index d618d3f8..61c8ce8e 100644
--- a/packages/shared/src/note-prose.ts
+++ b/packages/shared/src/note-prose.ts
@@ -19,7 +19,7 @@ export const NOTE_PROSE_PALETTE_IDS = [
] as const;
export type NoteProsePaletteId = (typeof NOTE_PROSE_PALETTE_IDS)[number];
-export const NOTE_PROSE_PALETTE_CHOICES = ["native", ...NOTE_PROSE_PALETTE_IDS, "custom"] as const;
+export const NOTE_PROSE_PALETTE_CHOICES = ["native", ...NOTE_PROSE_PALETTE_IDS] as const;
export type NoteProsePaletteChoice = (typeof NOTE_PROSE_PALETTE_CHOICES)[number];
export const MAX_NOTE_PROSE_CSS_BYTES = 8 * 1024;
@@ -262,8 +262,8 @@ export const parseNoteProseLineHeight = (value: unknown): NoteProseLineHeight |
};
export const parseNoteProsePalette = (value: unknown): NoteProsePaletteChoice | null => {
- // The green option was removed. Stored rows keep reading as the native palette.
- if (value === "emerald") return "native";
+ // Green and the custom color editor were removed. Stored rows read as native.
+ if (value === "emerald" || value === "custom") return "native";
return typeof value === "string" && (NOTE_PROSE_PALETTE_CHOICES as readonly string[]).includes(value)
? value as NoteProsePaletteChoice
: null;
@@ -295,7 +295,6 @@ export const paletteForLegacyEditorTheme = (theme: string | null | undefined): N
if (!theme || theme === "default" || theme === "marxico") return null;
const mapped = LEGACY_EDITOR_THEME_PALETTES[theme];
if (mapped) return mapped;
- if (theme === "custom" || theme.startsWith("custom-")) return "custom";
return null;
};
@@ -311,9 +310,7 @@ export const resolveNoteProse = (account: Partial<AccountNoteProse> | null | und
lineHeight: account?.lineHeight ?? DEFAULT_NOTE_PROSE_LINE_HEIGHT,
palette: parseNoteProsePalette(account?.palette) ?? "native",
customCss: account?.customCss ?? "",
- customColors: account?.palette === "custom"
- ? account.customColors ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS
- : account?.customColors ?? null,
+ customColors: account?.customColors ?? null,
});
export const publicNoteProseFromAccount = (account: Partial<AccountNoteProse> | null | undefined): PublicNoteProse => {
@@ -323,7 +320,7 @@ export const publicNoteProseFromAccount = (account: Partial<AccountNoteProse> |
lineHeight: resolved.lineHeight,
palette: resolved.palette,
customCss: resolved.customCss,
- customColors: resolved.palette === "custom" ? resolved.customColors : null,
+ customColors: null,
};
};
@@ -352,11 +349,9 @@ export const noteProseMigrationPatch = (
},
): NoteProsePatch => {
const patch: NoteProsePatch = {};
- if (account.palette == null && local.palette && local.palette !== "native") {
- patch.palette = local.palette;
- if (local.palette === "custom") {
- patch.customColors = local.customColors ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS;
- }
+ const palette = parseNoteProsePalette(local.palette);
+ if (account.palette == null && palette && palette !== "native") {
+ patch.palette = palette;
}
if (account.customCss == null && local.customCss?.trim()) {
patch.customCss = local.customCss;
@@ -366,20 +361,6 @@ export const noteProseMigrationPatch = (
export const noteProsePaletteColors = (prose: Pick<ResolvedNoteProse, "palette" | "customColors">): NoteProsePaletteColors | null => {
if (prose.palette === "native") return null;
- if (prose.palette === "custom") {
- const light = prose.customColors?.light ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS.light;
- return {
- accent: light.accent,
- text: light.text,
- muted: light.muted,
- surface: light.soft,
- divider: light.border,
- link: light.accent,
- codeBackground: light.codeBackground,
- codeText: light.text,
- background: light.background,
- };
- }
return NOTE_PROSE_PALETTES[prose.palette];
};
@@ -401,20 +382,5 @@ export const noteProseCssVariables = (prose: ResolvedNoteProse): Record<string,
variables["--note-palette-code-bg"] = colors.codeBackground;
variables["--note-palette-code-text"] = colors.codeText;
variables["--note-palette-bg"] = colors.background;
- if (prose.palette === "custom") {
- const light = prose.customColors?.light ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS.light;
- const dark = prose.customColors?.dark ?? DEFAULT_NOTE_PROSE_CUSTOM_COLORS.dark;
- variables["--note-palette-heading"] = light.heading;
- variables["--note-palette-dark-accent"] = dark.accent;
- variables["--note-palette-dark-text"] = dark.text;
- variables["--note-palette-dark-muted"] = dark.muted;
- variables["--note-palette-dark-heading"] = dark.heading;
- variables["--note-palette-dark-surface"] = dark.soft;
- variables["--note-palette-dark-divider"] = dark.border;
- variables["--note-palette-dark-link"] = dark.accent;
- variables["--note-palette-dark-code-bg"] = dark.codeBackground;
- variables["--note-palette-dark-code-text"] = dark.text;
- variables["--note-palette-dark-bg"] = dark.background;
- }
return variables;
};