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
Revert "feat: export notes as markdown and pdf"
tianma-if75a6299b5395
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsxindex e5e3828e..7212dea7 100644--- a/apps/web/src/components/EditorPane.tsx+++ b/apps/web/src/components/EditorPane.tsx@@ -31,8 +31,6 @@ import {CircleAlert,LoaderCircle,Info,- Download,- Printer,} from "lucide-react";import { Button } from "@/components/ui/button";import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";@@ -93,7 +91,6 @@ import {getNotebookMoveOptions,} from "@/lib/app-helpers";import { copyEditorToWeChat, copyMarkdownToWeChat } from "@/lib/wechat-copy";-import { buildSingleMarkdownExport, downloadMarkdownFile } from "@/lib/markdown-export";import { ThemeBlock } from "./ThemeBlock";import { SystemInfoDialog } from "./SystemInfoDialog";import { fetchLatestRelease, isVersionOutdated } from "@/lib/version-check";@@ -105,35 +102,6 @@ const EDITOR_AUTO_SAVE_DELAY_MS = 1200;const MOBILE_DRAFT_PERSIST_DELAY_MS = 800;const NOTE_SEARCH_HIGHLIGHT_PLUGIN_KEY = new PluginKey("edgeever-note-search-highlight");-const printCurrentMemo = () => {- const source = document.querySelector<HTMLElement>("[data-edgeever-editor-pane]");- const content = source?.querySelector<HTMLElement>(".ProseMirror");-- if (!source || !content) {- window.print();- return;- }-- const printRoot = document.createElement("article");- printRoot.className = "edgeever-print-root";-- const titleInput = source.querySelector<HTMLInputElement>('input[placeholder]');- const title = document.createElement("h1");- title.textContent = titleInput?.value.trim() || "Untitled note";- printRoot.appendChild(title);- printRoot.appendChild(content.cloneNode(true));-- const cleanup = () => {- document.body.classList.remove("edgeever-printing");- printRoot.remove();- };-- document.body.classList.add("edgeever-printing");- document.body.appendChild(printRoot);- window.addEventListener("afterprint", cleanup, { once: true });- window.print();-};-const IconTooltip = ({ label, children }: { label: string; children: ReactNode }) => (<TooltipProvider delayDuration={0} skipDelayDuration={0}><Tooltip>@@ -2510,30 +2478,8 @@ const RichEditorPane = ({});};- const getCurrentMarkdownForExport = () => {- if (useMobilePlainTextEditor) {- return getMobilePlainTextValue();- }-- if (useMarkdownSourceEditor) {- return markdownSource;- }-- return isEditorReady(editor) ? docToMarkdown(editor.getJSON() as TiptapDoc) : memo.contentMarkdown;- };-- const handleDownloadMarkdown = () => {- const exportMemo: MemoDetail = {- ...memo,- title,- tags: parseTagsText(tagsText),- contentMarkdown: getCurrentMarkdownForExport(),- };- downloadMarkdownFile(buildSingleMarkdownExport(exportMemo, currentNotebookLabel), title);- };-return (- <div className="relative flex h-full min-w-0 flex-col bg-white" data-edgeever-editor-pane>+ <div className="relative flex h-full min-w-0 flex-col bg-white">{selectionActionBar}<header className="shrink-0 border-b border-slate-200 bg-white"><div className="flex min-h-12 items-center justify-between gap-2 border-b border-slate-100 px-3 py-2 sm:px-5">@@ -2783,21 +2729,6 @@ const RichEditorPane = ({<History className="h-4 w-4 text-slate-500" />{t("editor.versionHistory")}</DropdownMenuItem>- <DropdownMenuSeparator className="my-1 h-px bg-slate-100" />- <DropdownMenuItem- className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"- onClick={handleDownloadMarkdown}- >- <Download className="h-4 w-4 text-slate-500" />- {t("editor.exportMarkdown")}- </DropdownMenuItem>- <DropdownMenuItem- className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"- onClick={printCurrentMemo}- >- <Printer className="h-4 w-4 text-slate-500" />- {t("editor.printPdf")}- </DropdownMenuItem>{readOnly ? (<><DropdownMenuItemdiff --git a/apps/web/src/lib/markdown-export.ts b/apps/web/src/lib/markdown-export.tsindex ca8b2b8d..1b88e09f 100644--- a/apps/web/src/lib/markdown-export.ts+++ b/apps/web/src/lib/markdown-export.ts@@ -109,9 +109,6 @@ export const buildMarkdownFrontMatter = (memo: MemoDetail, notebookPath: string)"",].join("\n");-export const buildSingleMarkdownExport = (memo: MemoDetail, notebookPath = "Unfiled") =>- `${buildMarkdownFrontMatter(memo, notebookPath)}${memo.contentMarkdown}`;-export const getExportResourceExtension = (resource: Resource) => {const filenameExtension = resource.filename?.match(/\.([a-z0-9]{1,12})$/i)?.[1];if (filenameExtension) {@@ -234,16 +231,3 @@ export const downloadMarkdownExport = (blob: Blob) => {anchor.remove();window.setTimeout(() => URL.revokeObjectURL(url), 1_000);};--export const downloadMarkdownFile = (markdown: string, title: string) => {- const filename = `${sanitizeExportPathSegment(title.trim() || "Untitled note", "Untitled note")}.md`;- const blob = new Blob([markdown], { type: "text/markdown;charset=utf-8" });- const url = URL.createObjectURL(blob);- const anchor = document.createElement("a");- anchor.href = url;- anchor.download = filename;- document.body.appendChild(anchor);- anchor.click();- anchor.remove();- window.setTimeout(() => URL.revokeObjectURL(url), 1_000);-};diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.cssindex c9c3d9ff..265da0c3 100644--- a/apps/web/src/styles/globals.css+++ b/apps/web/src/styles/globals.css@@ -1,98 +1,6 @@@import "highlight.js/styles/github.css";@import "./editor-themes/index.css";-@media print {- body.edgeever-printing > #root {- display: none !important;- }-- body.edgeever-printing > .edgeever-print-root {- display: block !important;- width: 100% !important;- margin: 0 !important;- padding: 0 !important;- background: white !important;- color: #0f172a !important;- font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif !important;- }-- .edgeever-print-root > h1 {- margin: 0 0 1.5rem !important;- color: #0f172a !important;- font-size: 2rem !important;- line-height: 1.2 !important;- }-- .edgeever-print-root .ProseMirror {- display: block !important;- min-height: 0 !important;- height: auto !important;- overflow: visible !important;- padding: 0 0 2rem !important;- font-family: inherit !important;- overflow-wrap: anywhere !important;- }-- .edgeever-print-root .edgeever-image-controls,- .edgeever-print-root .edgeever-code-copy-button,- .edgeever-print-root [data-radix-popper-content-wrapper] {- display: none !important;- }-- .edgeever-print-root .edgeever-mermaid-source {- display: none !important;- }-- .edgeever-print-root .edgeever-mermaid-preview {- display: block !important;- }-- .edgeever-print-root img,- .edgeever-print-root svg {- max-width: 100% !important;- }-- .edgeever-print-root .tableWrapper,- .edgeever-print-root pre,- .edgeever-print-root blockquote,- .edgeever-print-root tr,- .edgeever-print-root img {- break-inside: avoid;- }-- .edgeever-print-root .tableWrapper {- width: 100% !important;- max-width: 100% !important;- overflow: visible !important;- }-- .edgeever-print-root table {- width: 100% !important;- min-width: 0 !important;- max-width: 100% !important;- table-layout: fixed !important;- }-- .edgeever-print-root col {- width: auto !important;- }-- .edgeever-print-root th,- .edgeever-print-root td {- min-width: 0 !important;- max-width: none !important;- white-space: normal !important;- overflow-wrap: anywhere !important;- word-break: break-word !important;- }-}--@media screen {- .edgeever-print-root {- display: none;- }-}-@tailwind base;@tailwind components;@tailwind utilities;diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 0adf3dc8..9a2cb6bd 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -549,8 +549,6 @@ export const enUS = {searchCurrentMemo: "Search current note",replaceCurrentMemo: "Replace in current note",versionHistory: "Version history",- exportMarkdown: "Export Markdown",- printPdf: "Print / Save as PDF",save: "Save",more: "More",moreAria: "More note actions",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 55471ca0..4d23127a 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -549,8 +549,6 @@ export const zhCN = {searchCurrentMemo: "搜索当前笔记",replaceCurrentMemo: "替换当前笔记",versionHistory: "版本历史",- exportMarkdown: "导出 Markdown",- printPdf: "打印 / 保存为 PDF",save: "保存",more: "更多",moreAria: "笔记更多操作",diff --git a/tests/markdown-export.test.ts b/tests/markdown-export.test.tsindex d15fccce..a8544f0e 100644--- a/tests/markdown-export.test.ts+++ b/tests/markdown-export.test.ts@@ -3,7 +3,6 @@ import type { MemoDetail, Notebook, Resource } from "@edgeever/shared";import { strFromU8, unzipSync } from "fflate";import {buildMarkdownFrontMatter,- buildSingleMarkdownExport,buildNotebookExportPaths,createMarkdownExport,sanitizeExportPathSegment,@@ -105,12 +104,4 @@ describe("Markdown export", () => {"");});-- test("builds a standalone Markdown file with note metadata", () => {- const markdown = buildSingleMarkdownExport(memo(), "工作/项目");-- expect(markdown).toStartWith('---\ntitle: "项目笔记"\n');- expect(markdown).toContain('notebook: "工作/项目"');- expect(markdown).toEndWith("");- });});