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): confirm hidden platform copy with an ink toast

tianma-if628016729e91
diff --git a/apps/web/src/components/ClipboardCopyNotice.tsx b/apps/web/src/components/ClipboardCopyNotice.tsx
index ad1ed565..d97ec722 100644
--- a/apps/web/src/components/ClipboardCopyNotice.tsx
+++ b/apps/web/src/components/ClipboardCopyNotice.tsx
@@ -14,8 +14,8 @@ export const ClipboardCopyNotice = ({
return createPortal(
<div
className={cn(
- "fixed bottom-[max(1.25rem,env(safe-area-inset-bottom))] left-1/2 z-[120] inline-flex max-w-[calc(100vw-2rem)] -translate-x-1/2 rounded-md px-3 py-2 text-sm font-medium text-white shadow-lg sm:max-w-xl",
- status === "copied" ? "bg-emerald-700" : "bg-rose-600",
+ "fixed bottom-[max(1.25rem,env(safe-area-inset-bottom))] left-1/2 z-[120] inline-flex max-w-[calc(100vw-2rem)] -translate-x-1/2 rounded-md px-3 py-2 text-sm font-medium shadow-lg sm:max-w-xl",
+ status === "copied" ? "bg-slate-900 text-slate-50" : "bg-rose-600 text-rose-50",
)}
role={status === "copied" ? "status" : "alert"}
>
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index 4aeb1e8a..2c6053cd 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -4311,6 +4311,12 @@ const RichEditorPane = ({
</ClipboardCopyNotice>
)}
+ {(wechatCopyState === "copied" || wechatCopyState === "error") && (
+ <ClipboardCopyNotice status={wechatCopyState === "copied" ? "copied" : "error"}>
+ {t(wechatCopyState === "copied" ? "editor.copiedToWeChat" : "editor.copyToWeChatFailed")}
+ </ClipboardCopyNotice>
+ )}
+
{isMobileViewport && !mobileEditingActive && !readOnly && (
<Button
className="fixed bottom-[calc(1rem+env(safe-area-inset-bottom))] right-4 z-30 h-12 w-12 rounded-full shadow-lg sm:hidden"
diff --git a/tests/note-id-copy.test.ts b/tests/note-id-copy.test.ts
index 982cf01d..d1c123d1 100644
--- a/tests/note-id-copy.test.ts
+++ b/tests/note-id-copy.test.ts
@@ -20,6 +20,9 @@ describe("copy current note ID", () => {
expect(webEditorSource).toContain("<ClipboardCopyNotice");
expect(webCopyNoticeSource).toContain("createPortal(");
expect(webCopyNoticeSource).toContain("document.body");
+ expect(webCopyNoticeSource).toContain('status === "copied" ? "bg-slate-900 text-slate-50" : "bg-rose-600 text-rose-50"');
+ expect(webCopyNoticeSource).not.toContain("bg-emerald-");
+ expect(webCopyNoticeSource).not.toContain("text-white");
});
test("copies the raw memo ID from both native mobile clients", () => {
diff --git a/tests/note-sharing-menu.test.ts b/tests/note-sharing-menu.test.ts
index fbdf7b72..cbc447d0 100644
--- a/tests/note-sharing-menu.test.ts
+++ b/tests/note-sharing-menu.test.ts
@@ -22,6 +22,13 @@ describe("note sharing menu", () => {
expect(editorSource).toContain('aria-label={t(isLocalMemoId(memo.id) ? "sharing.afterSync" : isMemoShared ? "sharing.manage" : "sharing.action")}');
});
+ test("shows a toast after copying the note for other platforms", () => {
+ expect(editorSource).toContain('wechatCopyState === "copied" || wechatCopyState === "error"');
+ expect(editorSource).toContain('t(wechatCopyState === "copied" ? "editor.copiedToWeChat" : "editor.copyToWeChatFailed")');
+ expect(zhCN.editor.copiedToWeChat).toBe("已复制");
+ expect(enUS.editor.copiedToWeChat).toBe("Copied");
+ });
+
test("explains why sharing a newly created local note is disabled", () => {
expect(zhCN.sharing.afterSync).toBe("同步后可分享笔记");
expect(enUS.sharing.afterSync).toBe("Share note after sync");