Skip to content

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

Open Evernote guide in new tab

tianma27d940b31b7d
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index 99fcba7c..55dc1a6f 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -1,6 +1,7 @@
import { useEffect } from "react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { api } from "@/lib/api";
+import { EvernoteImportGuidePane } from "@/components/EvernoteImportGuidePane";
import { LoginScreen } from "@/components/LoginScreen";
import { WorkspaceApp } from "@/components/WorkspaceApp";
import type { AuthSession } from "@edgeever/shared";
@@ -14,6 +15,21 @@ const AuthLoadingScreen = () => (
export const App = () => {
const queryClient = useQueryClient();
+ if (window.location.pathname === "/evernote-migration") {
+ return (
+ <EvernoteImportGuidePane
+ onClose={() => {
+ if (window.opener) {
+ window.close();
+ return;
+ }
+
+ window.location.href = "/";
+ }}
+ />
+ );
+ }
+
const sessionQuery = useQuery({
queryKey: ["auth", "session"],
queryFn: () => api.getSession(),
diff --git a/apps/web/src/components/EvernoteImportCard.tsx b/apps/web/src/components/EvernoteImportCard.tsx
index a8aef3d7..6ea3e98c 100644
--- a/apps/web/src/components/EvernoteImportCard.tsx
+++ b/apps/web/src/components/EvernoteImportCard.tsx
@@ -3,7 +3,6 @@ import { FileArchive, FileCheck2, HelpCircle, Play, RotateCcw, UploadCloud } fro
import { useQueryClient } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
-import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
import { api } from "@/lib/api";
import { cn } from "@/lib/utils";
import { parseEvernoteExportFiles, type EvernoteImportNotebook } from "@/lib/evernote-import";
@@ -15,103 +14,6 @@ type ImportedNotebookSummary = {
createdCount: number;
};
-const EvernoteImportGuideDialog = () => (
- <Dialog>
- <DialogTrigger asChild>
- <Button size="sm" variant="outline" className="h-7 bg-white px-2.5 text-xs" type="button">
- <HelpCircle className="h-3.5 w-3.5" />
- 操作指引
- </Button>
- </DialogTrigger>
- <DialogContent className="max-h-[82vh] max-w-3xl gap-4 overflow-hidden p-0">
- <DialogHeader className="border-b border-slate-100 px-5 py-4">
- <DialogTitle className="text-base">从印象笔记迁移到 EdgeEver</DialogTitle>
- <DialogDescription className="leading-5">
- EdgeEver 只支持开放、可读取的 ENEX 文件;不直接支持印象笔记新版客户端导出的 .notes 文件。
- </DialogDescription>
- </DialogHeader>
- <div className="space-y-5 overflow-y-auto px-5 pb-5 text-sm leading-6 text-slate-700">
- <GuideSection title="准备 ENEX 文件">
- <p>如果印象笔记客户端仍能直接导出 ENEX,可以按笔记本分别导出 .enex 文件。</p>
- <p>如果客户端只能导出 .notes,可以参考第三方命令行工具 evernote-backup 先导出 ENEX:</p>
- <pre className="overflow-x-auto rounded-md border border-slate-100 bg-slate-950 p-3 text-xs leading-5 text-slate-100">
- <code>{`pipx install evernote-backup
-evernote-backup init-db --backend china
-evernote-backup sync
-evernote-backup export ./edgeever-import`}</code>
- </pre>
- <ul className="list-disc space-y-1 pl-5">
- <li><code>--backend china</code> 用于连接印象笔记中国版。</li>
- <li><code>sync</code> 会把账号里的笔记同步到本地数据库。</li>
- <li><code>export ./edgeever-import</code> 会导出 ENEX 文件。</li>
- <li>evernote-backup 默认会按笔记本导出,一个笔记本对应一个 .enex 文件。</li>
- </ul>
- </GuideSection>
-
- <GuideSection title="在 Web 应用中导入">
- <ol className="list-decimal space-y-1 pl-5">
- <li>在电脑浏览器中打开 EdgeEver。</li>
- <li>进入左侧“个人中心 / 我的”。</li>
- <li>找到“导入印象笔记”。</li>
- <li>选择一个或多个 .enex 文件。</li>
- <li>检查导入计划中的笔记本数量和笔记数量。</li>
- <li>点击“开始导入”。</li>
- <li>每导完一个笔记本,先在 EdgeEver 中检查结果,再点击“确认结果,继续下一个”。</li>
- </ol>
- <p>移动端不开放导入入口。ENEX 文件通常较大,逐笔记本确认也更适合 PC 操作。</p>
- </GuideSection>
-
- <GuideSection title="时间校验">
- <p>EdgeEver 会强制保留印象笔记原始创建时间和修改时间:</p>
- <ul className="list-disc space-y-1 pl-5">
- <li>如果 ENEX 中某条笔记缺少合法的创建时间或修改时间,导入会停止。</li>
- <li>如果 EdgeEver 创建后的 <code>createdAt</code> 或 <code>updatedAt</code> 与 ENEX 原始时间不一致,导入会停止并显示对应笔记标题。</li>
- </ul>
- </GuideSection>
-
- <GuideSection title="命令行导入">
- <p>命令行脚本适合自托管管理员、开发者和需要批处理的高级用户。普通产品用户优先使用 Web 导入入口。</p>
- <pre className="overflow-x-auto rounded-md border border-slate-100 bg-slate-950 p-3 text-xs leading-5 text-slate-100">
- <code>{`bun run cli -- profile set prod --url https://你的域名 --token <api-token>
-bun run import:evernote -- --profile prod --input ./edgeever-import --dry-run
-bun run import:evernote -- --profile prod --input ./edgeever-import`}</code>
- </pre>
- <p>API Token 至少需要 <code>read:notebooks</code>、<code>write:notebooks</code>、<code>write:memos</code>。</p>
- </GuideSection>
-
- <GuideSection title="常见问题">
- <GuideFaq
- question="EdgeEver 为什么不直接支持 .notes?"
- answer="印象笔记新版 .notes 文件可能包含 encoding=&quot;base64:aes&quot; 加密内容。EdgeEver 无法可靠读取和校验这类文件,因此产品层面只承诺支持 ENEX。"
- />
- <GuideFaq
- question="附件和图片会怎样?"
- answer="当前导入主要迁移文本内容、标题、标签和时间。ENEX 中的图片和附件会被转换成 evernote-resource:<hash> 形式的占位链接,便于后续定位原始资源。"
- />
- <GuideFaq
- question="笔记格式会完全一致吗?"
- answer="不会完全一致。工具会把印象笔记的 XHTML 内容转换为 Markdown,再交给 EdgeEver 保存。常规标题、段落、列表、代码块、链接和待办项会尽量保留;复杂表格、加密块、特殊样式和附件需要迁移后抽查。"
- />
- </GuideSection>
- </div>
- </DialogContent>
- </Dialog>
-);
-
-const GuideSection = ({ title, children }: { title: string; children: React.ReactNode }) => (
- <section className="space-y-2">
- <h3 className="text-sm font-bold text-slate-950">{title}</h3>
- {children}
- </section>
-);
-
-const GuideFaq = ({ question, answer }: { question: string; answer: string }) => (
- <div className="rounded-lg border border-slate-100 bg-slate-50/70 p-3">
- <div className="text-sm font-bold text-slate-900">{question}</div>
- <p className="mt-1 text-sm leading-6 text-slate-600">{answer}</p>
- </div>
-);
-
export const EvernoteImportCard = () => {
const queryClient = useQueryClient();
const inputRef = useRef<HTMLInputElement | null>(null);
@@ -231,7 +133,12 @@ export const EvernoteImportCard = () => {
<CardTitle className="flex items-center gap-2 text-sm">
<UploadCloud className="h-4 w-4 text-emerald-700" />
导入印象笔记
- <EvernoteImportGuideDialog />
+ <Button size="sm" variant="outline" className="h-7 bg-white px-2.5 text-xs" type="button" asChild>
+ <a href="/evernote-migration" target="_blank" rel="noreferrer">
+ <HelpCircle className="h-3.5 w-3.5" />
+ 操作指引
+ </a>
+ </Button>
</CardTitle>
<CardDescription className="text-xs leading-4">
按笔记本选择 .enex 文件,EdgeEver 会逐个笔记本导入并保留原始创建、修改时间。
diff --git a/apps/web/src/components/EvernoteImportGuidePane.tsx b/apps/web/src/components/EvernoteImportGuidePane.tsx
new file mode 100644
index 00000000..1d6174c2
--- /dev/null
+++ b/apps/web/src/components/EvernoteImportGuidePane.tsx
@@ -0,0 +1,109 @@
+import { ChevronLeft, Download, HelpCircle, UploadCloud } from "lucide-react";
+import type { ReactNode } from "react";
+import { Button } from "@/components/ui/button";
+
+export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) => (
+ <div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
+ <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 bg-white px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:px-6 lg:pb-0 lg:pt-0">
+ <div className="flex min-w-0 items-center gap-3">
+ <Button
+ size="icon"
+ variant="ghost"
+ title="返回我的"
+ aria-label="返回我的"
+ onClick={onClose}
+ className="h-9 w-9 rounded-lg hover:bg-slate-100"
+ >
+ <ChevronLeft className="h-5 w-5 text-slate-500" />
+ </Button>
+ <div className="min-w-0">
+ <h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
+ <HelpCircle className="h-4 w-4 text-emerald-700" />
+ 印象笔记迁移指引
+ </h1>
+ <p className="mt-0.5 truncate text-xs font-medium text-slate-400">先导出 ENEX,再回 EdgeEver 导入</p>
+ </div>
+ </div>
+ </header>
+
+ <main className="min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-4 lg:px-6 lg:py-6">
+ <article className="mx-auto grid w-full min-w-0 max-w-4xl gap-4">
+ <section className="rounded-lg border border-emerald-100 bg-white p-5 shadow-none">
+ <h2 className="text-lg font-bold text-slate-950">最省事的迁移方式</h2>
+ <p className="mt-3 text-sm leading-6 text-slate-600">
+ EdgeEver 只导入 .enex 文件。先用 evernote-backup 从印象笔记导出 ENEX,再回到这里选择文件导入。
+ </p>
+ </section>
+
+ <GuideStep
+ index="1"
+ icon={<Download className="h-4 w-4" />}
+ title="用 evernote-backup 导出 ENEX"
+ >
+ <p>在电脑终端执行下面几行命令:</p>
+ <GuideCode>{`pipx install evernote-backup
+evernote-backup init-db --backend china
+evernote-backup sync
+evernote-backup export ./edgeever-import`}</GuideCode>
+ <p>完成后,当前目录会出现 <code>edgeever-import</code> 文件夹,里面是一批 .enex 文件。通常一个笔记本对应一个 .enex 文件。</p>
+ <p>只想导出部分笔记本时,可以在最后一行加上笔记本名:</p>
+ <GuideCode>{`evernote-backup export ./edgeever-import --notebook "工作项目"`}</GuideCode>
+ </GuideStep>
+
+ <GuideStep
+ index="2"
+ icon={<UploadCloud className="h-4 w-4" />}
+ title="回到 EdgeEver 导入"
+ >
+ <ol className="list-decimal space-y-1 pl-5">
+ <li>回到“我的”页面里的“导入印象笔记”。</li>
+ <li>点击“选择文件”,选择 <code>edgeever-import</code> 里的 .enex 文件。</li>
+ <li>确认导入计划里的笔记本数量和笔记数量。</li>
+ <li>点击“开始导入”。</li>
+ <li>每导完一个笔记本,先检查结果,再点击“确认结果,继续下一个”。</li>
+ </ol>
+ </GuideStep>
+
+ <GuideStep index="3" icon={<HelpCircle className="h-4 w-4" />} title="如果遇到问题">
+ <ul className="list-disc space-y-1 pl-5">
+ <li>EdgeEver 只支持 .enex,不支持印象笔记新版 .notes。</li>
+ <li>如果导入中断,先检查最后一个已导入的笔记本,避免重复导入。</li>
+ <li>EdgeEver 会校验原始创建时间和修改时间;时间不一致时会停止导入。</li>
+ <li>图片和附件当前会保留为资源占位链接,重要附件建议迁移后抽查。</li>
+ </ul>
+ </GuideStep>
+ </article>
+ </main>
+ </div>
+);
+
+const GuideStep = ({
+ index,
+ icon,
+ title,
+ children,
+}: {
+ index: string;
+ icon: ReactNode;
+ title: string;
+ children: ReactNode;
+}) => (
+ <section className="rounded-lg border border-slate-200 bg-white p-5 text-sm leading-6 text-slate-700 shadow-none">
+ <div className="mb-3 flex items-center gap-3">
+ <div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-50 text-emerald-700">
+ {icon}
+ </div>
+ <div className="min-w-0">
+ <div className="text-xs font-bold text-slate-400">步骤 {index}</div>
+ <h2 className="text-base font-bold text-slate-950">{title}</h2>
+ </div>
+ </div>
+ <div className="space-y-3">{children}</div>
+ </section>
+);
+
+const GuideCode = ({ children }: { children: string }) => (
+ <pre className="overflow-x-auto rounded-md border border-slate-100 bg-slate-950 p-3 text-xs leading-5 text-slate-100">
+ <code>{children}</code>
+ </pre>
+);