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
refactor: streamline editor toolbar
tianma-ifa16c781cf549
diff --git a/apps/web/src/components/EditorToolbar.tsx b/apps/web/src/components/EditorToolbar.tsxindex d0fb8520..576347fd 100644--- a/apps/web/src/components/EditorToolbar.tsx+++ b/apps/web/src/components/EditorToolbar.tsx@@ -10,8 +10,6 @@ import {Code2,List,ListOrdered,- ListIndentDecrease,- ListIndentIncrease,Quote,SquareCode,ChartNoAxesCombined,@@ -40,21 +38,18 @@ const EditorToolbarButton = ({disabled = false,onClick,title,- wide = false,}: {active?: boolean;children: ReactNode;disabled?: boolean;onClick: () => void;title: string;- wide?: boolean;}) => (<Tooltip><TooltipTrigger asChild><buttonclassName={cn(- "flex h-8 shrink-0 items-center justify-center rounded-md border text-slate-700 transition disabled:pointer-events-none disabled:opacity-40",- wide ? "w-auto gap-1 px-2" : "w-8",+ "flex h-8 w-8 shrink-0 items-center justify-center rounded-md border text-slate-700 transition disabled:pointer-events-none disabled:opacity-40",active? "border-emerald-200 bg-emerald-50 text-emerald-800": "border-transparent bg-transparent hover:border-slate-200 hover:bg-slate-50"@@ -73,7 +68,7 @@ const EditorToolbarButton = ({</Tooltip>);-const ToolbarDivider = () => <div className="h-6 w-px shrink-0 bg-slate-200" />;+const ToolbarDivider = () => <div className="hidden h-6 w-px shrink-0 bg-slate-200 sm:block" />;const isToolbarEditorReady = (editor: Editor | null): editor is Editor =>Boolean(editor && !editor.isDestroyed && (editor as { extensionManager?: unknown }).extensionManager);@@ -226,11 +221,11 @@ export const EditorToolbar = ({return (<TooltipProvider delayDuration={0} skipDelayDuration={0}>- <div className="relative border-t border-slate-200 bg-white">+ <div className="relative min-w-0 max-w-full border-t border-slate-200 bg-white"><div className="pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-white to-transparent sm:hidden" /><div className="pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-white to-transparent sm:hidden" /><div- className="flex min-h-12 items-center gap-2 overflow-x-auto px-3 py-2 [scrollbar-width:none] sm:px-5 [&::-webkit-scrollbar]:hidden"+ className="flex min-w-0 max-w-full flex-wrap items-center gap-1 overflow-visible px-3 py-2 sm:gap-2 sm:px-5"role="toolbar"aria-label={t("editorToolbar.toolbar")}>@@ -272,12 +267,10 @@ export const EditorToolbar = ({<><EditorToolbarButtontitle={t("editorToolbar.noteLink")}- widedisabled={readOnly}onClick={onPickNoteLink}><Link2 className="h-4 w-4" />- <span className="text-xs font-medium">{t("editorToolbar.noteLink")}</span></EditorToolbarButton><ToolbarDivider /></>@@ -354,7 +347,7 @@ export const EditorToolbar = ({<ToolbarDivider /><EditorToolbarButton- title={t("editorToolbar.bulletList")}+ title={`${t("editorToolbar.bulletList")} · ${t("editorToolbar.listIndentHint")}`}active={isActive("bulletList")}disabled={disabled}onClick={() => run((current) => current.chain().focus().toggleBulletList().run())}@@ -362,27 +355,13 @@ export const EditorToolbar = ({<List className="h-4 w-4" /></EditorToolbarButton><EditorToolbarButton- title={t("editorToolbar.orderedList")}+ title={`${t("editorToolbar.orderedList")} · ${t("editorToolbar.listIndentHint")}`}active={isActive("orderedList")}disabled={disabled}onClick={() => run((current) => current.chain().focus().toggleOrderedList().run())}><ListOrdered className="h-4 w-4" /></EditorToolbarButton>- <EditorToolbarButton- title={t("editorToolbar.increaseListIndent")}- disabled={!canRun((current) => current.can().chain().focus().sinkListItem("listItem").run())}- onClick={() => run((current) => current.chain().focus().sinkListItem("listItem").run())}- >- <ListIndentIncrease className="h-4 w-4" />- </EditorToolbarButton>- <EditorToolbarButton- title={t("editorToolbar.decreaseListIndent")}- disabled={!canRun((current) => current.can().chain().focus().liftListItem("listItem").run())}- onClick={() => run((current) => current.chain().focus().liftListItem("listItem").run())}- >- <ListIndentDecrease className="h-4 w-4" />- </EditorToolbarButton><EditorToolbarButtontitle={t("editorToolbar.quote")}active={isActive("blockquote")}@@ -399,14 +378,6 @@ export const EditorToolbar = ({><SquareCode className="h-4 w-4" /></EditorToolbarButton>- <EditorToolbarButton- title={t("editorToolbar.mermaidDiagram")}- active={codeBlockActive && codeBlockLanguage === "mermaid"}- disabled={disabled}- onClick={() => run(insertMermaidDiagram)}- >- <ChartNoAxesCombined className="h-4 w-4" />- </EditorToolbarButton>{showCodeLanguageSelector && (<Selectvalue={codeBlockLanguage}@@ -430,6 +401,14 @@ export const EditorToolbar = ({</SelectContent></Select>)}+ <EditorToolbarButton+ title={t("editorToolbar.mermaidDiagram")}+ active={codeBlockActive && codeBlockLanguage === "mermaid"}+ disabled={disabled}+ onClick={() => run(insertMermaidDiagram)}+ >+ <ChartNoAxesCombined className="h-4 w-4" />+ </EditorToolbarButton><EditorToolbarButtontitle={t("editorToolbar.horizontalRule")}disabled={disabled}@@ -438,18 +417,23 @@ export const EditorToolbar = ({<Minus className="h-4 w-4" /></EditorToolbarButton><DropdownMenu>- <DropdownMenuTrigger asChild>- <button- type="button"- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent text-slate-700 transition hover:border-slate-200 hover:bg-slate-50 disabled:pointer-events-none disabled:opacity-40"- aria-label={t("editorToolbar.themeBlock")}- title={t("editorToolbar.themeBlock")}- disabled={disabled}- onMouseDown={(event) => event.preventDefault()}- >- <Blocks className="h-4 w-4" />- </button>- </DropdownMenuTrigger>+ <Tooltip>+ <TooltipTrigger asChild>+ <DropdownMenuTrigger asChild>+ <button+ type="button"+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent text-slate-700 transition hover:border-slate-200 hover:bg-slate-50 disabled:pointer-events-none disabled:opacity-40"+ aria-label={t("editorToolbar.themeBlock")}+ title={t("editorToolbar.themeBlock")}+ disabled={disabled}+ onMouseDown={(event) => event.preventDefault()}+ >+ <Blocks className="h-4 w-4" />+ </button>+ </DropdownMenuTrigger>+ </TooltipTrigger>+ <TooltipContent>{t("editorToolbar.themeBlock")}</TooltipContent>+ </Tooltip><DropdownMenuContent align="end">{(["intro", "key-point", "callout", "chapter"] as ThemeBlockKind[]).map((kind) => (<DropdownMenuItem key={kind} onSelect={() => run((current) => insertThemeBlock(current, kind))}>diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 6704852c..b78863ea 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -631,6 +631,7 @@ export const enUS = {orderedList: "Numbered list",increaseListIndent: "Increase list level (Tab)",decreaseListIndent: "Decrease list level (Shift + Tab)",+ listIndentHint: "Tab increases level · Shift + Tab decreases level",quote: "Quote",codeBlock: "Code block",copyCode: "Copy code",@@ -645,7 +646,7 @@ export const enUS = {mermaidEmpty: "Enter Mermaid source below to generate a diagram.",mermaidSource: "Mermaid source",horizontalRule: "Divider",- themeBlock: "Themed block",+ themeBlock: "Insert content block",deleteThemeBlock: "Delete themed block",themeBlocks: {intro: "Intro card",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex bd02e42b..76dee84f 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -631,6 +631,7 @@ export const zhCN = {orderedList: "有序列表",increaseListIndent: "增加列表层级(Tab)",decreaseListIndent: "减少列表层级(Shift + Tab)",+ listIndentHint: "Tab 增加层级,Shift + Tab 减少层级",quote: "引用",codeBlock: "代码块",copyCode: "复制代码",@@ -645,7 +646,7 @@ export const zhCN = {mermaidEmpty: "在下方输入 Mermaid 源码以生成图表。",mermaidSource: "Mermaid 源码",horizontalRule: "分割线",- themeBlock: "主题化组件",+ themeBlock: "插入内容块",deleteThemeBlock: "删除主题化组件",themeBlocks: {intro: "引言卡片",