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
Use textarea markdown editor on mobile
yoma8447b6d4fcf9
diff --git a/apps/web/mobile-edit.html b/apps/web/mobile-edit.htmlnew file mode 100644index 00000000..6ca716be--- /dev/null+++ b/apps/web/mobile-edit.html@@ -0,0 +1,22 @@+<!doctype html>+<html lang="zh-CN">+ <head>+ <meta charset="UTF-8" />+ <meta+ name="viewport"+ content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content"+ />+ <meta name="theme-color" content="#ffffff" />+ <meta name="mobile-web-app-capable" content="yes" />+ <meta name="apple-mobile-web-app-capable" content="yes" />+ <meta name="apple-mobile-web-app-status-bar-style" content="default" />+ <meta name="format-detection" content="telephone=no" />+ <link rel="icon" href="/favicon.svg" type="image/svg+xml" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <title>编辑笔记 - EdgeEver</title>+ </head>+ <body>+ <div id="mobile-editor-root"></div>+ <script type="module" src="/src/mobile-edit.tsx"></script>+ </body>+</html>diff --git a/apps/web/public/mobile-edit.html b/apps/web/public/mobile-edit.htmldeleted file mode 100644index 83fbfdb1..00000000--- a/apps/web/public/mobile-edit.html+++ /dev/null@@ -1,536 +0,0 @@-<!doctype html>-<html lang="zh-CN">- <head>- <meta charset="utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />- <title>编辑笔记 - EdgeEver</title>- <style>- * {- box-sizing: border-box;- }-- html,- body {- min-height: 100%;- }-- body {- margin: 0;- background: #fff;- color: #0f172a;- font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;- }-- header {- position: sticky;- top: 0;- z-index: 2;- display: flex;- min-height: 52px;- align-items: center;- justify-content: space-between;- gap: 8px;- border-bottom: 1px solid #f1f5f9;- background: #fff;- padding: max(8px, env(safe-area-inset-top)) 12px 8px;- }-- main {- display: grid;- gap: 12px;- padding: 16px 16px max(24px, env(safe-area-inset-bottom));- }-- button {- border: 0;- border-radius: 999px;- background: transparent;- color: #0f172a;- font: inherit;- font-weight: 700;- min-height: 36px;- padding: 7px 12px;- }-- button.primary {- background: #020617;- color: #fff;- }-- button:disabled {- background: #e2e8f0;- color: #64748b;- }-- .status {- border-radius: 999px;- background: #f1f5f9;- color: #64748b;- font-size: 12px;- font-weight: 700;- padding: 6px 10px;- }-- .status.dirty,- .status.saving {- background: #ecfdf5;- color: #047857;- }-- .status.error {- background: #fff1f2;- color: #be123c;- }-- .field {- display: grid;- gap: 6px;- }-- .meta {- display: flex;- flex-wrap: wrap;- gap: 8px;- }-- .tools {- display: flex;- flex-wrap: wrap;- gap: 8px;- }-- .tool-button {- border: 1px solid #cbd5e1;- background: #fff;- color: #334155;- font-size: 14px;- min-height: 34px;- padding: 6px 12px;- }-- input,- textarea {- width: 100%;- border: 0;- background: #fff;- color: #0f172a;- font: inherit;- outline: none;- padding: 0;- }-- input.title {- font-size: 30px;- font-weight: 800;- line-height: 1.2;- }-- input.tags {- border-radius: 8px;- color: #64748b;- font-size: 15px;- line-height: 1.5;- padding: 6px 0;- }-- textarea {- min-height: 72dvh;- resize: none;- font-size: 18px;- line-height: 1.65;- padding-top: 12px;- white-space: pre-wrap;- }-- input::placeholder,- textarea::placeholder {- color: #94a3b8;- }-- .error-box {- display: none;- border: 1px solid #fecdd3;- border-radius: 8px;- background: #fff1f2;- color: #9f1239;- font-size: 14px;- line-height: 1.5;- padding: 10px;- }-- .error-box.show {- display: block;- }- </style>- </head>- <body>- <header>- <button id="back" type="button" aria-label="返回">‹</button>- <div style="display: flex; min-width: 0; flex: 1; justify-content: flex-end; gap: 8px">- <span class="status" id="status">加载中</span>- <button class="primary" id="done" type="button">完成</button>- </div>- </header>-- <main>- <div class="error-box" id="error"></div>- <label class="field">- <input class="title" id="title" autocomplete="on" autocorrect="on" inputmode="text" placeholder="无标题笔记" />- </label>- <div class="meta">- <input class="tags" id="tags" autocomplete="on" autocorrect="on" inputmode="text" placeholder="添加标签,用逗号分隔" />- </div>- <div class="tools">- <button class="tool-button" id="upload-image" type="button">图片</button>- <button class="tool-button" id="upload-file" type="button">附件</button>- </div>- <input id="image-input" type="file" accept="image/png,image/jpeg,image/gif,image/webp,image/avif" hidden />- <input id="file-input" type="file" hidden />- <textarea id="body" autocomplete="on" autocorrect="on" inputmode="text" enterkeyhint="enter" autofocus placeholder="开始记录..."></textarea>- </main>-- <script>- const AUTO_SAVE_DELAY_MS = 1200;- const DRAFT_STORAGE_PREFIX = "edgeever-mobile-edit-draft:";- const params = new URLSearchParams(location.hash ? location.hash.slice(1) : location.search);- const memoId = params.get("memoId");- const returnTo = params.get("returnTo") || "/";- const titleInput = document.getElementById("title");- const tagsInput = document.getElementById("tags");- const bodyInput = document.getElementById("body");- const statusNode = document.getElementById("status");- const errorNode = document.getElementById("error");- const doneButton = document.getElementById("done");- const backButton = document.getElementById("back");- const uploadImageButton = document.getElementById("upload-image");- const uploadFileButton = document.getElementById("upload-file");- const imageInput = document.getElementById("image-input");- const fileInput = document.getElementById("file-input");- let memo = null;- let dirty = false;- let saving = false;- let leaving = false;- let saveTimer = 0;- let lastSavedSnapshot = "";- let currentSavePromise = null;-- const draftKey = () => `${DRAFT_STORAGE_PREFIX}${memoId}`;- const safeReturnTo = returnTo && returnTo.startsWith("/") ? returnTo : "/";-- const setStatus = (label, kind = "") => {- statusNode.textContent = label;- statusNode.className = `status ${kind}`.trim();- };-- const showError = (message) => {- errorNode.textContent = message;- errorNode.classList.add("show");- setStatus("保存失败", "error");- };-- const clearError = () => {- errorNode.textContent = "";- errorNode.classList.remove("show");- };-- const docToMarkdown = (doc) => {- if (!doc || !Array.isArray(doc.content)) return "";- return doc.content- .map((node) => blockToMarkdown(node))- .filter(Boolean)- .join("\\n\\n");- };-- const blockToMarkdown = (node) => {- if (!node || typeof node !== "object") return "";- if (node.type === "image") return imageToMarkdown(node.attrs);- if (node.type === "heading") {- const level = Math.min(Math.max(Number(node.attrs && node.attrs.level) || 1, 1), 6);- const text = inlineText(node.content);- return text ? `${"#".repeat(level)} ${text}` : "";- }- if (node.type === "horizontalRule") return "---";- return inlineText(node.content);- };-- const inlineText = (content) => {- if (!Array.isArray(content)) return "";- return content- .map((node) => {- if (!node || typeof node !== "object") return "";- if (typeof node.text === "string") return node.text;- if (node.type === "hardBreak") return "\\n";- if (node.type === "image") return imageToMarkdown(node.attrs);- return inlineText(node.content);- })- .join("");- };-- const imageToMarkdown = (attrs) => {- const src = stringAttr(attrs, "src");- if (!src) return "";- const alt = stringAttr(attrs, "alt").replace(/\]/g, "\\]");- const title = stringAttr(attrs, "title");- const titleSuffix = title ? ` "${title.replace(/"/g, '\\"')}"` : "";- return ``;- };-- const stringAttr = (attrs, key) => {- const value = attrs && attrs[key];- return typeof value === "string" ? value.trim() : "";- };-- const parseTags = (value) =>- value- .split(/[,,]/)- .map((tag) => tag.trim())- .filter(Boolean);-- const currentSnapshot = () =>- JSON.stringify({- title: titleInput.value,- tagsText: tagsInput.value,- body: bodyInput.value,- });-- const persistLocalDraft = () => {- if (!memoId) return;- localStorage.setItem(- draftKey(),- JSON.stringify({- title: titleInput.value,- tagsText: tagsInput.value,- body: bodyInput.value,- updatedAt: new Date().toISOString(),- })- );- };-- const readLocalDraft = () => {- if (!memoId) return null;- try {- const raw = localStorage.getItem(draftKey());- return raw ? JSON.parse(raw) : null;- } catch {- return null;- }- };-- const request = async (path, init) => {- const response = await fetch(path, {- credentials: "include",- ...init,- headers: {- "Content-Type": "application/json",- ...(init && init.headers ? init.headers : {}),- },- });-- if (!response.ok) {- const body = await response.json().catch(() => null);- throw new Error(body && body.error && body.error.message ? body.error.message : response.statusText);- }-- return response.json();- };-- const uploadResource = async (file) => {- if (!memo || !file) return;- const form = new FormData();- form.append("file", file);- setStatus("上传中", "saving");- uploadImageButton.disabled = true;- uploadFileButton.disabled = true;- clearError();-- try {- const response = await fetch(`/api/v1/memos/${encodeURIComponent(memo.id)}/resources`, {- method: "POST",- credentials: "include",- body: form,- });-- if (!response.ok) {- const body = await response.json().catch(() => null);- throw new Error(body && body.error && body.error.message ? body.error.message : response.statusText);- }-- const data = await response.json();- insertResourceMarkdown(data.resource);- scheduleSave();- void saveNow();- } catch (error) {- showError(error && error.message ? error.message : "上传失败");- } finally {- uploadImageButton.disabled = false;- uploadFileButton.disabled = false;- }- };-- const insertResourceMarkdown = (resource) => {- if (!resource || !resource.url) return;- const filename = resource.filename || "附件";- const text =- resource.kind === "image"- ? ``- : `附件:${filename}\\n${resource.url}`;- insertAtCursor(`\\n\\n${text}\\n\\n`);- };-- const insertAtCursor = (text) => {- const start = bodyInput.selectionStart || 0;- const end = bodyInput.selectionEnd || start;- const value = bodyInput.value;- bodyInput.value = `${value.slice(0, start)}${text}${value.slice(end)}`;- const nextCursor = start + text.length;- bodyInput.focus();- bodyInput.setSelectionRange(nextCursor, nextCursor);- };-- const escapeMarkdownLabel = (value) => String(value).replace(/\]/g, "\\]");-- const saveNow = async ({ keepalive = false } = {}) => {- if (!memo) return false;- if (saving) return currentSavePromise || false;- const snapshot = currentSnapshot();- if (!dirty && snapshot === lastSavedSnapshot) return true;-- window.clearTimeout(saveTimer);- saving = true;- doneButton.disabled = true;- setStatus("保存中", "saving");- clearError();-- currentSavePromise = (async () => {- const data = await request(`/api/v1/memos/${encodeURIComponent(memo.id)}`, {- method: "PATCH",- keepalive,- body: JSON.stringify({- expectedRevision: memo.revision,- title: titleInput.value,- contentMarkdown: bodyInput.value,- tags: parseTags(tagsInput.value),- }),- });- memo = data.memo;- lastSavedSnapshot = currentSnapshot();- dirty = false;- localStorage.removeItem(draftKey());- setStatus("已保存");- return true;- })();-- try {- return await currentSavePromise;- } catch (error) {- persistLocalDraft();- showError(error && error.message ? error.message : "保存失败,已保留本地草稿");- return false;- } finally {- saving = false;- currentSavePromise = null;- doneButton.disabled = false;- }- };-- const scheduleSave = () => {- dirty = true;- persistLocalDraft();- setStatus("未保存", "dirty");- window.clearTimeout(saveTimer);- saveTimer = window.setTimeout(() => void saveNow(), AUTO_SAVE_DELAY_MS);- };-- const navigateBack = () => {- window.location.replace(safeReturnTo);- };-- const leavePage = async () => {- if (leaving) return;- leaving = true;- persistLocalDraft();- window.clearTimeout(saveTimer);- setStatus("返回中", "saving");- doneButton.disabled = true;-- await Promise.race([- saveNow({ keepalive: true }),- new Promise((resolve) => window.setTimeout(resolve, 1600)),- ]);- navigateBack();- };-- const loadMemo = async () => {- if (!memoId) {- showError("缺少 memoId");- return;- }-- try {- const data = await request(`/api/v1/memos/${encodeURIComponent(memoId)}`);- memo = data.memo;- titleInput.value = memo.title || "";- tagsInput.value = Array.isArray(memo.tags) ? memo.tags.join(", ") : "";- bodyInput.value = memo.contentMarkdown || docToMarkdown(memo.contentJson);-- const draft = readLocalDraft();- if (draft && Date.parse(draft.updatedAt || "") >= Date.parse(memo.updatedAt || "")) {- titleInput.value = draft.title || "";- tagsInput.value = draft.tagsText || "";- bodyInput.value = draft.body || "";- dirty = true;- setStatus("本地草稿", "dirty");- scheduleSave();- } else {- lastSavedSnapshot = currentSnapshot();- setStatus("已保存");- }-- for (const delay of [0, 120, 500]) {- window.setTimeout(() => bodyInput.focus(), delay);- }- } catch (error) {- showError(error && error.message ? error.message : "加载失败");- }- };-- for (const element of [titleInput, tagsInput, bodyInput]) {- element.addEventListener("input", scheduleSave);- }-- doneButton.addEventListener("click", () => void leavePage());- backButton.addEventListener("click", () => void leavePage());- uploadImageButton.addEventListener("click", () => imageInput.click());- uploadFileButton.addEventListener("click", () => fileInput.click());- imageInput.addEventListener("change", () => {- const file = imageInput.files && imageInput.files[0];- imageInput.value = "";- void uploadResource(file);- });- fileInput.addEventListener("change", () => {- const file = fileInput.files && fileInput.files[0];- fileInput.value = "";- void uploadResource(file);- });- window.history.replaceState({ edgeeverMobileEditor: true }, "");- window.history.pushState({ edgeeverMobileEditorBackGuard: true }, "");- window.addEventListener("popstate", () => {- void leavePage();- });- window.addEventListener("pagehide", () => {- if (dirty) {- persistLocalDraft();- void saveNow({ keepalive: true });- }- });- document.addEventListener("visibilitychange", () => {- if (document.visibilityState === "hidden" && dirty) {- persistLocalDraft();- void saveNow({ keepalive: true });- }- });-- void loadMemo();- </script>- </body>-</html>diff --git a/apps/web/src/mobile-edit.tsx b/apps/web/src/mobile-edit.tsxnew file mode 100644index 00000000..03542f36--- /dev/null+++ b/apps/web/src/mobile-edit.tsx@@ -0,0 +1,574 @@+import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { createRoot } from "react-dom/client";+import MDEditor, { commands } from "@uiw/react-md-editor/nohighlight";+import type { PreviewType } from "@uiw/react-md-editor";+import "@uiw/react-md-editor/markdown-editor.css";+import { docToMarkdown, type MemoDetail, type Resource, type TiptapDoc } from "@edgeever/shared";+import "./styles/mobile-markdown-editor.css";++const AUTO_SAVE_DELAY_MS = 1200;+const LEAVE_SAVE_TIMEOUT_MS = 1600;+const DRAFT_STORAGE_PREFIX = "edgeever-mobile-edit-draft:";+const DEFAULT_MEMO_TITLE = "无标题笔记";++type MemoResponse = {+ memo: MemoDetail;+};++type ResourceResponse = {+ resource: Resource;+};++type MobileDraft = {+ title: string;+ tagsText: string;+ body: string;+ updatedAt: string;+};++type SaveState = "loading" | "idle" | "dirty" | "saving" | "saved" | "uploading" | "error" | "local-draft" | "leaving";++const getParams = () => new URLSearchParams(window.location.hash ? window.location.hash.slice(1) : window.location.search);++const parseTags = (value: string) =>+ value+ .split(/[,,]/)+ .map((tag) => tag.trim())+ .filter(Boolean);++const escapeMarkdownLabel = (value: string) => value.replace(/\]/g, "\\]");++const safeReturnPath = (value: string | null) => (value?.startsWith("/") ? value : "/");++const requestJson = async <T,>(path: string, init?: RequestInit): Promise<T> => {+ const headers = new Headers(init?.headers);++ if (!(init?.body instanceof FormData) && !headers.has("Content-Type")) {+ headers.set("Content-Type", "application/json");+ }++ const response = await fetch(path, {+ credentials: "include",+ ...init,+ headers,+ });++ if (!response.ok) {+ const body = await response.json().catch(() => null);+ const message =+ body && typeof body === "object" && "error" in body+ ? (body as { error?: { message?: string } }).error?.message+ : response.statusText;+ throw new Error(message || "Request failed");+ }++ return response.json() as Promise<T>;+};++const uploadResource = async (memoId: string, file: File) => {+ const form = new FormData();+ form.append("file", file);++ return requestJson<ResourceResponse>(`/api/v1/memos/${encodeURIComponent(memoId)}/resources`, {+ method: "POST",+ body: form,+ });+};++const markdownForResource = (resource: Resource) => {+ const filename = resource.filename || "附件";++ if (resource.kind === "image") {+ return ``;+ }++ return `附件:${filename}\n${resource.url}`;+};++const insertAtCursor = (value: string, insertion: string) => {+ const textarea = document.querySelector<HTMLTextAreaElement>(".edgeever-mobile-md-editor textarea");+ const start = textarea?.selectionStart ?? value.length;+ const end = textarea?.selectionEnd ?? start;+ const nextValue = `${value.slice(0, start)}${insertion}${value.slice(end)}`;+ const nextCursor = start + insertion.length;++ window.setTimeout(() => {+ textarea?.focus();+ textarea?.setSelectionRange(nextCursor, nextCursor);+ }, 0);++ return nextValue;+};++const MobileMarkdownEditorApp = () => {+ const params = useMemo(() => getParams(), []);+ const memoId = params.get("memoId");+ const returnTo = safeReturnPath(params.get("returnTo"));+ const draftKey = memoId ? `${DRAFT_STORAGE_PREFIX}${memoId}` : "";+ const [memo, setMemo] = useState<MemoDetail | null>(null);+ const memoRef = useRef<MemoDetail | null>(null);+ const [title, setTitle] = useState("");+ const titleRef = useRef("");+ const [tagsText, setTagsText] = useState("");+ const tagsTextRef = useRef("");+ const [markdown, setMarkdown] = useState("");+ const markdownRef = useRef("");+ const [preview, setPreview] = useState<PreviewType>("edit");+ const [saveState, setSaveState] = useState<SaveState>("loading");+ const [error, setError] = useState<string | null>(null);+ const dirtyRef = useRef(false);+ const leavingRef = useRef(false);+ const savingRef = useRef(false);+ const saveTimerRef = useRef<number | null>(null);+ const currentSavePromiseRef = useRef<Promise<boolean> | null>(null);+ const lastSavedSnapshotRef = useRef("");+ const imageInputRef = useRef<HTMLInputElement | null>(null);+ const fileInputRef = useRef<HTMLInputElement | null>(null);++ useEffect(() => {+ memoRef.current = memo;+ }, [memo]);++ useEffect(() => {+ titleRef.current = title;+ }, [title]);++ useEffect(() => {+ tagsTextRef.current = tagsText;+ }, [tagsText]);++ useEffect(() => {+ markdownRef.current = markdown;+ }, [markdown]);++ const currentSnapshot = useCallback(+ () =>+ JSON.stringify({+ title: titleRef.current,+ tagsText: tagsTextRef.current,+ body: markdownRef.current,+ }),+ []+ );++ const persistLocalDraft = useCallback(() => {+ if (!draftKey) {+ return;+ }++ const draft: MobileDraft = {+ title: titleRef.current,+ tagsText: tagsTextRef.current,+ body: markdownRef.current,+ updatedAt: new Date().toISOString(),+ };+ localStorage.setItem(draftKey, JSON.stringify(draft));+ }, [draftKey]);++ const readLocalDraft = useCallback((): MobileDraft | null => {+ if (!draftKey) {+ return null;+ }++ try {+ const raw = localStorage.getItem(draftKey);+ return raw ? (JSON.parse(raw) as MobileDraft) : null;+ } catch {+ return null;+ }+ }, [draftKey]);++ const saveNow = useCallback(+ async ({ keepalive = false }: { keepalive?: boolean } = {}) => {+ const currentMemo = memoRef.current;+ if (!currentMemo) {+ return false;+ }++ if (savingRef.current) {+ return currentSavePromiseRef.current ?? false;+ }++ const snapshot = currentSnapshot();+ if (!dirtyRef.current && snapshot === lastSavedSnapshotRef.current) {+ return true;+ }++ if (saveTimerRef.current !== null) {+ window.clearTimeout(saveTimerRef.current);+ saveTimerRef.current = null;+ }++ savingRef.current = true;+ setSaveState("saving");+ setError(null);++ currentSavePromiseRef.current = (async () => {+ const data = await requestJson<MemoResponse>(`/api/v1/memos/${encodeURIComponent(currentMemo.id)}`, {+ method: "PATCH",+ keepalive,+ body: JSON.stringify({+ expectedRevision: currentMemo.revision,+ title: titleRef.current,+ contentMarkdown: markdownRef.current,+ tags: parseTags(tagsTextRef.current),+ }),+ });++ setMemo(data.memo);+ lastSavedSnapshotRef.current = currentSnapshot();+ dirtyRef.current = false;+ if (draftKey) {+ localStorage.removeItem(draftKey);+ }+ setSaveState("saved");+ window.setTimeout(() => {+ if (!dirtyRef.current && !savingRef.current && !leavingRef.current) {+ setSaveState("idle");+ }+ }, 1200);+ return true;+ })();++ try {+ return await currentSavePromiseRef.current;+ } catch (saveError) {+ persistLocalDraft();+ setError(saveError instanceof Error ? saveError.message : "保存失败,已保留本地草稿");+ setSaveState("error");+ return false;+ } finally {+ savingRef.current = false;+ currentSavePromiseRef.current = null;+ }+ },+ [currentSnapshot, draftKey, persistLocalDraft]+ );++ const scheduleSave = useCallback(() => {+ dirtyRef.current = true;+ persistLocalDraft();+ setSaveState("dirty");++ if (saveTimerRef.current !== null) {+ window.clearTimeout(saveTimerRef.current);+ }+ saveTimerRef.current = window.setTimeout(() => {+ saveTimerRef.current = null;+ void saveNow();+ }, AUTO_SAVE_DELAY_MS);+ }, [persistLocalDraft, saveNow]);++ const navigateBack = useCallback(() => {+ window.location.replace(returnTo);+ }, [returnTo]);++ const leavePage = useCallback(async () => {+ if (leavingRef.current) {+ return;+ }++ leavingRef.current = true;+ persistLocalDraft();+ if (saveTimerRef.current !== null) {+ window.clearTimeout(saveTimerRef.current);+ saveTimerRef.current = null;+ }+ setSaveState("leaving");++ await Promise.race([+ saveNow({ keepalive: true }),+ new Promise((resolve) => window.setTimeout(resolve, LEAVE_SAVE_TIMEOUT_MS)),+ ]);+ navigateBack();+ }, [navigateBack, persistLocalDraft, saveNow]);++ const handleTitleChange = (nextTitle: string) => {+ setTitle(nextTitle);+ titleRef.current = nextTitle;+ scheduleSave();+ };++ const handleTagsChange = (nextTagsText: string) => {+ setTagsText(nextTagsText);+ tagsTextRef.current = nextTagsText;+ scheduleSave();+ };++ const handleMarkdownChange = (nextMarkdown?: string) => {+ const value = nextMarkdown ?? "";+ setMarkdown(value);+ markdownRef.current = value;+ scheduleSave();+ };++ const handleUpload = async (file?: File | null) => {+ const currentMemo = memoRef.current;+ if (!currentMemo || !file) {+ return;+ }++ setSaveState("uploading");+ setError(null);++ try {+ const data = await uploadResource(currentMemo.id, file);+ const insertion = `\n\n${markdownForResource(data.resource)}\n\n`;+ const nextMarkdown = insertAtCursor(markdownRef.current, insertion);+ setMarkdown(nextMarkdown);+ markdownRef.current = nextMarkdown;+ dirtyRef.current = true;+ persistLocalDraft();+ void saveNow();+ } catch (uploadError) {+ setError(uploadError instanceof Error ? uploadError.message : "上传失败");+ setSaveState("error");+ }+ };++ useEffect(() => {+ if (!memoId) {+ setError("缺少 memoId");+ setSaveState("error");+ return;+ }++ let cancelled = false;++ void (async () => {+ try {+ const data = await requestJson<MemoResponse>(`/api/v1/memos/${encodeURIComponent(memoId)}`);+ if (cancelled) {+ return;+ }++ const nextTitle = data.memo.title || "";+ const nextTagsText = Array.isArray(data.memo.tags) ? data.memo.tags.join(", ") : "";+ const nextMarkdown = data.memo.contentMarkdown || docToMarkdown(data.memo.contentJson as TiptapDoc);+ const draft = readLocalDraft();+ const useDraft = Boolean(draft && Date.parse(draft.updatedAt || "") >= Date.parse(data.memo.updatedAt || ""));++ setMemo(data.memo);++ if (useDraft && draft) {+ setTitle(draft.title || "");+ titleRef.current = draft.title || "";+ setTagsText(draft.tagsText || "");+ tagsTextRef.current = draft.tagsText || "";+ setMarkdown(draft.body || "");+ markdownRef.current = draft.body || "";+ dirtyRef.current = true;+ setSaveState("local-draft");+ scheduleSave();+ } else {+ setTitle(nextTitle);+ titleRef.current = nextTitle;+ setTagsText(nextTagsText);+ tagsTextRef.current = nextTagsText;+ setMarkdown(nextMarkdown);+ markdownRef.current = nextMarkdown;+ lastSavedSnapshotRef.current = JSON.stringify({+ title: nextTitle,+ tagsText: nextTagsText,+ body: nextMarkdown,+ });+ dirtyRef.current = false;+ setSaveState("idle");+ }++ for (const delay of [0, 120, 500]) {+ window.setTimeout(() => {+ document.querySelector<HTMLTextAreaElement>(".edgeever-mobile-md-editor textarea")?.focus();+ }, delay);+ }+ } catch (loadError) {+ if (cancelled) {+ return;+ }+ setError(loadError instanceof Error ? loadError.message : "加载失败");+ setSaveState("error");+ }+ })();++ return () => {+ cancelled = true;+ };+ }, [memoId, readLocalDraft, scheduleSave]);++ useEffect(() => {+ window.history.replaceState({ edgeeverMobileEditor: true }, "");+ window.history.pushState({ edgeeverMobileEditorBackGuard: true }, "");++ const handlePopState = () => {+ void leavePage();+ };+ const handlePageHide = () => {+ if (dirtyRef.current) {+ persistLocalDraft();+ void saveNow({ keepalive: true });+ }+ };+ const handleVisibilityChange = () => {+ if (document.visibilityState === "hidden" && dirtyRef.current) {+ persistLocalDraft();+ void saveNow({ keepalive: true });+ }+ };++ window.addEventListener("popstate", handlePopState);+ window.addEventListener("pagehide", handlePageHide);+ document.addEventListener("visibilitychange", handleVisibilityChange);++ return () => {+ window.removeEventListener("popstate", handlePopState);+ window.removeEventListener("pagehide", handlePageHide);+ document.removeEventListener("visibilitychange", handleVisibilityChange);+ if (saveTimerRef.current !== null) {+ window.clearTimeout(saveTimerRef.current);+ }+ };+ }, [leavePage, persistLocalDraft, saveNow]);++ const saveLabel =+ saveState === "loading"+ ? "加载中"+ : saveState === "saving"+ ? "保存中"+ : saveState === "uploading"+ ? "上传中"+ : saveState === "dirty"+ ? "未保存"+ : saveState === "saved"+ ? "已保存"+ : saveState === "local-draft"+ ? "本地草稿"+ : saveState === "leaving"+ ? "返回中"+ : saveState === "error"+ ? "保存失败"+ : "已保存";++ const statusClassName =+ saveState === "error" ? "error" : saveState === "dirty" || saveState === "saving" || saveState === "uploading" || saveState === "leaving" ? "active" : "";++ return (+ <div className="mobile-editor-shell">+ <header className="mobile-editor-header">+ <button className="mobile-editor-back" type="button" aria-label="返回" onClick={() => void leavePage()}>+ ‹+ </button>+ <div className="mobile-editor-actions">+ <span className={`mobile-editor-status ${statusClassName}`}>{saveLabel}</span>+ <button className="mobile-editor-done" type="button" disabled={saveState === "loading"} onClick={() => void leavePage()}>+ 完成+ </button>+ </div>+ </header>++ <main className="mobile-editor-main">+ {error && <div className="mobile-editor-error">{error}</div>}+ <input+ className="mobile-editor-title"+ value={title}+ autoComplete="on"+ autoCorrect="on"+ inputMode="text"+ placeholder={DEFAULT_MEMO_TITLE}+ onChange={(event) => handleTitleChange(event.target.value)}+ />+ <input+ className="mobile-editor-tags"+ value={tagsText}+ autoComplete="on"+ autoCorrect="on"+ inputMode="text"+ placeholder="添加标签,用逗号分隔"+ onChange={(event) => handleTagsChange(event.target.value)}+ />++ <div className="mobile-editor-tool-row">+ <button type="button" onClick={() => imageInputRef.current?.click()} disabled={!memo || saveState === "uploading"}>+ 图片+ </button>+ <button type="button" onClick={() => fileInputRef.current?.click()} disabled={!memo || saveState === "uploading"}>+ 附件+ </button>+ <div className="mobile-editor-preview-toggle" role="group" aria-label="编辑预览切换">+ <button type="button" aria-pressed={preview === "edit"} onClick={() => setPreview("edit")}>+ 编辑+ </button>+ <button type="button" aria-pressed={preview === "preview"} onClick={() => setPreview("preview")}>+ 预览+ </button>+ </div>+ </div>+ <input+ ref={imageInputRef}+ type="file"+ accept="image/png,image/jpeg,image/gif,image/webp,image/avif"+ hidden+ onChange={(event) => {+ const file = event.target.files?.[0];+ event.target.value = "";+ void handleUpload(file);+ }}+ />+ <input+ ref={fileInputRef}+ type="file"+ hidden+ onChange={(event) => {+ const file = event.target.files?.[0];+ event.target.value = "";+ void handleUpload(file);+ }}+ />++ <div className="edgeever-mobile-md-editor" data-color-mode="light">+ <MDEditor+ value={markdown}+ preview={preview}+ height="calc(100dvh - 15.75rem)"+ minHeight={360}+ visibleDragbar={false}+ enableScroll+ autoFocus+ autoFocusEnd+ textareaProps={{+ autoComplete: "on",+ autoCorrect: "on",+ inputMode: "text",+ enterKeyHint: "enter",+ spellCheck: true,+ placeholder: "开始记录...",+ "aria-label": "笔记正文",+ }}+ commands={[+ commands.bold,+ commands.italic,+ commands.heading,+ commands.quote,+ commands.unorderedListCommand,+ commands.orderedListCommand,+ commands.link,+ ]}+ extraCommands={[]}+ onChange={handleMarkdownChange}+ />+ </div>+ </main>+ </div>+ );+};++const root = document.getElementById("mobile-editor-root");++if (!root) {+ throw new Error("Mobile editor root not found");+}++createRoot(root).render(+ <React.StrictMode>+ <MobileMarkdownEditorApp />+ </React.StrictMode>+);diff --git a/apps/web/src/styles/mobile-markdown-editor.css b/apps/web/src/styles/mobile-markdown-editor.cssnew file mode 100644index 00000000..081c4c5c--- /dev/null+++ b/apps/web/src/styles/mobile-markdown-editor.css@@ -0,0 +1,232 @@+:root {+ color-scheme: light;+ font-synthesis: none;+ text-rendering: optimizeLegibility;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+}++* {+ box-sizing: border-box;+}++html,+body,+#mobile-editor-root {+ min-height: 100%;+}++body {+ margin: 0;+ background: #fff;+ color: #0f172a;+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;+}++button,+input,+textarea {+ font: inherit;+}++.mobile-editor-shell {+ min-height: 100dvh;+ background: #fff;+}++.mobile-editor-header {+ position: sticky;+ top: 0;+ z-index: 10;+ display: flex;+ min-height: 52px;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+ border-bottom: 1px solid #f1f5f9;+ background: #fff;+ padding: max(8px, env(safe-area-inset-top)) 12px 8px;+}++.mobile-editor-back,+.mobile-editor-done,+.mobile-editor-tool-row button,+.mobile-editor-preview-toggle button {+ border: 0;+ border-radius: 999px;+ background: transparent;+ color: #0f172a;+ font-weight: 700;+ min-height: 36px;+ padding: 7px 12px;+}++.mobile-editor-back {+ min-width: 38px;+ padding: 4px 8px;+ font-size: 30px;+ font-weight: 400;+ line-height: 1;+}++.mobile-editor-actions {+ display: flex;+ min-width: 0;+ flex: 1;+ justify-content: flex-end;+ gap: 8px;+}++.mobile-editor-done {+ background: #020617;+ color: #fff;+}++.mobile-editor-done:disabled,+.mobile-editor-tool-row button:disabled {+ background: #e2e8f0;+ color: #64748b;+}++.mobile-editor-status {+ align-self: center;+ border-radius: 999px;+ background: #f1f5f9;+ color: #64748b;+ font-size: 12px;+ font-weight: 700;+ padding: 6px 10px;+ white-space: nowrap;+}++.mobile-editor-status.active {+ background: #ecfdf5;+ color: #047857;+}++.mobile-editor-status.error {+ background: #fff1f2;+ color: #be123c;+}++.mobile-editor-main {+ display: grid;+ gap: 10px;+ padding: 14px 12px max(16px, env(safe-area-inset-bottom));+}++.mobile-editor-error {+ border: 1px solid #fecdd3;+ border-radius: 8px;+ background: #fff1f2;+ color: #9f1239;+ font-size: 14px;+ line-height: 1.5;+ padding: 10px;+}++.mobile-editor-title,+.mobile-editor-tags {+ width: 100%;+ border: 0;+ background: #fff;+ color: #0f172a;+ outline: none;+}++.mobile-editor-title {+ font-size: 28px;+ font-weight: 800;+ line-height: 1.2;+}++.mobile-editor-tags {+ color: #64748b;+ font-size: 15px;+ line-height: 1.5;+ padding: 4px 0;+}++.mobile-editor-title::placeholder,+.mobile-editor-tags::placeholder {+ color: #94a3b8;+}++.mobile-editor-tool-row {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 8px;+}++.mobile-editor-tool-row > button {+ border: 1px solid #cbd5e1;+ background: #fff;+ color: #334155;+ font-size: 14px;+ min-height: 34px;+ padding: 6px 12px;+}++.mobile-editor-preview-toggle {+ display: inline-flex;+ overflow: hidden;+ border: 1px solid #cbd5e1;+ border-radius: 999px;+ margin-left: auto;+}++.mobile-editor-preview-toggle button {+ border-radius: 0;+ color: #475569;+ font-size: 14px;+ min-height: 34px;+ padding: 6px 12px;+}++.mobile-editor-preview-toggle button[aria-pressed="true"] {+ background: #0f172a;+ color: #fff;+}++.edgeever-mobile-md-editor .w-md-editor {+ border: 1px solid #e2e8f0;+ border-radius: 8px;+ box-shadow: none;+}++.edgeever-mobile-md-editor .w-md-editor-toolbar {+ border-color: #e2e8f0;+ background: #f8fafc;+}++.edgeever-mobile-md-editor .w-md-editor-toolbar li > button {+ height: 30px;+ min-width: 30px;+ color: #334155;+}++.edgeever-mobile-md-editor .w-md-editor-text-input,+.edgeever-mobile-md-editor .w-md-editor-text-pre > code,+.edgeever-mobile-md-editor .w-md-editor-text-pre {+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;+ font-size: 17px !important;+ line-height: 1.65 !important;+}++.edgeever-mobile-md-editor .w-md-editor-text-input {+ caret-color: auto;+}++.edgeever-mobile-md-editor .wmde-markdown {+ background: #fff;+ color: #0f172a;+ font-size: 16px;+ line-height: 1.65;+}++.edgeever-mobile-md-editor .wmde-markdown img {+ height: auto;+ max-width: 100%;+ border-radius: 8px;+}diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.tsindex 0b4bed14..c691727f 100644--- a/apps/web/vite.config.ts+++ b/apps/web/vite.config.ts@@ -89,6 +89,10 @@ export default defineConfig({outDir: "dist",emptyOutDir: true,rolldownOptions: {+ input: {+ app: fileURLToPath(new URL("./index.html", import.meta.url)),+ "mobile-edit": fileURLToPath(new URL("./mobile-edit.html", import.meta.url)),+ },output: {codeSplitting: {groups: [diff --git a/bun.lock b/bun.lockindex 0354d836..7f416cfb 100644--- a/bun.lock+++ b/bun.lock@@ -21,6 +21,7 @@"@tiptap/extension-placeholder": "latest","@tiptap/react": "latest","@tiptap/starter-kit": "latest",+ "@uiw/react-md-editor": "^4.1.1","class-variance-authority": "latest","clsx": "latest","cmdk": "^1.1.1",@@ -855,6 +856,8 @@"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-fc3KiUoBt6kie0N9bIW3E47vZsuaMf0PM2AaUpLCLT0s/LvX1nxAim6Fc049cNxODPpGm6qRAuUOB86SkRuPQw=="],+ "@types/prismjs": ["@types/[email protected]", "", {}, "sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw=="],+"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw=="],"@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],@@ -873,6 +876,12 @@"@types/yauzl": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],+ "@uiw/copy-to-clipboard": ["@uiw/[email protected]", "", {}, "sha512-apdzZJyJC/IEj21N22ry1H022pgpSA+FwNKxmvOGQ9rUMdyRbHf1nZq2UwqnfGOuTr7iOKLzNgWsCJtAwyAZpw=="],++ "@uiw/react-markdown-preview": ["@uiw/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.17.2", "@uiw/copy-to-clipboard": "~1.0.12", "react-markdown": "~10.1.0", "rehype-attr": "~4.0.0", "rehype-autolink-headings": "~7.1.0", "rehype-ignore": "^2.0.0", "rehype-prism-plus": "~2.0.0", "rehype-raw": "^7.0.0", "rehype-rewrite": "~4.0.0", "rehype-slug": "~6.0.0", "remark-gfm": "~4.0.0", "remark-github-blockquote-alert": "^1.0.0", "unist-util-visit": "^5.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-JjvcHveT6glhlJYJx1XGBZij6wkw+VwREV6Z6m/GpsjPPdLjF1x8nlPBSB/ATyUF4lD7C8ttMkCqVH9N9XMgEA=="],++ "@uiw/react-md-editor": ["@uiw/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.14.6", "@uiw/react-markdown-preview": "^5.2.0", "rehype": "~13.0.0", "rehype-prism-plus": "~2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-yZqV5twN/sSfpce4cO/1bqy16o7v2oW324VNh2gcnsSpzOr2jEHpchM+ElD1y+ivUmFXcDZ5Ky5TOuPZg4qL6g=="],+"@ungap/structured-clone": ["@ungap/[email protected]", "", {}, "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA=="],"@vitejs/plugin-react": ["@vitejs/[email protected]", "", { "dependencies": { "@rolldown/pluginutils": "^1.0.1" }, "peerDependencies": { "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", "babel-plugin-react-compiler": "^1.0.0", "vite": "^8.0.0" }, "optionalPeers": ["@rolldown/plugin-babel", "babel-plugin-react-compiler"] }, "sha512-vmFvco5/QuC2f9Oj+wTk0+9XeDFkHxSamwZKYc7MxYwKICfvUvlMhqKI0VuICPltGqh1neqBKDvO4kes1ya8vg=="],@@ -967,6 +976,8 @@"baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-BSSLZ9/Cjjv7Gtj5B68ZzXcXUg8iOf3fme+FCuh8rC/Go+Kmh8cox7M3A8dolou16s64QjLPOSdngh7GxXvkSw=="],+ "bcp-47-match": ["[email protected]", "", {}, "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ=="],+"binary-extensions": ["[email protected]", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="],"blake3-wasm": ["[email protected]", "", {}, "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g=="],@@ -1067,6 +1078,8 @@"css-select": ["[email protected]", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", "domhandler": "^5.0.2", "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw=="],+ "css-selector-parser": ["[email protected]", "", {}, "sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g=="],+"css-tree": ["[email protected]", "", { "dependencies": { "mdn-data": "2.27.1", "source-map-js": "^1.2.1" } }, "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA=="],"css-what": ["[email protected]", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="],@@ -1115,6 +1128,8 @@"diff": ["[email protected]", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="],+ "direction": ["[email protected]", "", { "bin": { "direction": "cli.js" } }, "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA=="],+"dlv": ["[email protected]", "", {}, "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="],"dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="],@@ -1301,12 +1316,18 @@"hast-util-from-parse5": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="],+ "hast-util-has-property": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA=="],++ "hast-util-heading-rank": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA=="],+"hast-util-is-element": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="],"hast-util-parse-selector": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="],"hast-util-raw": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-from-parse5": "^8.0.0", "hast-util-to-parse5": "^8.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "parse5": "^7.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw=="],+ "hast-util-select": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "bcp-47-match": "^2.0.0", "comma-separated-tokens": "^2.0.0", "css-selector-parser": "^3.0.0", "devlop": "^1.0.0", "direction": "^2.0.0", "hast-util-has-property": "^3.0.0", "hast-util-to-string": "^3.0.0", "hast-util-whitespace": "^3.0.0", "nth-check": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw=="],+"hast-util-to-estree": ["[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-attach-comments": "^3.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w=="],"hast-util-to-html": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="],@@ -1315,6 +1336,8 @@"hast-util-to-parse5": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA=="],+ "hast-util-to-string": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A=="],+"hast-util-to-text": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-find-after": "^5.0.0" } }, "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A=="],"hast-util-whitespace": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="],@@ -1327,6 +1350,8 @@"html-parse-stringify": ["[email protected]", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="],+ "html-url-attributes": ["[email protected]", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="],+"html-void-elements": ["[email protected]", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],"htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "entities": "^7.0.1" } }, "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ=="],@@ -1705,6 +1730,8 @@"parse-latin": ["[email protected]", "", { "dependencies": { "@types/nlcst": "^2.0.0", "@types/unist": "^3.0.0", "nlcst-to-string": "^4.0.0", "unist-util-modify-children": "^4.0.0", "unist-util-visit-children": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ=="],+ "parse-numeric-range": ["[email protected]", "", {}, "sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ=="],+"parse5": ["[email protected]", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="],"parse5-htmlparser2-tree-adapter": ["[email protected]", "", { "dependencies": { "domhandler": "^5.0.3", "parse5": "^7.0.0" } }, "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g=="],@@ -1813,6 +1840,8 @@"react-is": ["[email protected]", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],+ "react-markdown": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "html-url-attributes": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" }, "peerDependencies": { "@types/react": ">=18", "react": ">=18" } }, "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ=="],+"react-refresh": ["[email protected]", "", {}, "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw=="],"react-remove-scroll": ["[email protected]", "", { "dependencies": { "react-remove-scroll-bar": "^2.3.7", "react-style-singleton": "^2.2.3", "tslib": "^2.1.0", "use-callback-ref": "^1.3.3", "use-sidecar": "^1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q=="],@@ -1837,6 +1866,8 @@"reflect.getprototypeof": ["[email protected]", "", { "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-abstract": "^1.23.9", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.7", "get-proto": "^1.0.1", "which-builtin-type": "^1.2.1" } }, "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw=="],+ "refractor": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/prismjs": "^1.0.0", "hastscript": "^9.0.0", "parse-entities": "^4.0.0" } }, "sha512-QXOrHQF5jOpjjLfiNk5GFnWhRXvxjUVnlFxkeDmewR5sXkr3iM46Zo+CnRR8B+MDVqkULW4EcLVcRBNOPXHosw=="],+"regenerate": ["[email protected]", "", {}, "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A=="],"regenerate-unicode-properties": ["[email protected]", "", { "dependencies": { "regenerate": "^1.4.2" } }, "sha512-m03P+zhBeQd1RGnYxrGyDAPpWX/epKirLrp8e3qevZdVkKtnCrjjWczIbYc8+xd6vcTStVlqfycTx1KR4LOr0g=="],@@ -1857,16 +1888,30 @@"rehype": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "rehype-parse": "^9.0.0", "rehype-stringify": "^10.0.0", "unified": "^11.0.0" } }, "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A=="],+ "rehype-attr": ["[email protected]", "", { "dependencies": { "unified": "~11.0.0", "unist-util-visit": "~5.0.0" } }, "sha512-v4+gw7pvUVLbG/dUpLgBE6r3TWTBYJ7z+sfAH3zapmM5CKzk5+CopFQgr4gMR6OBSKl/qpI6HR7gv1Cbig0uow=="],++ "rehype-autolink-headings": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-heading-rank": "^3.0.0", "hast-util-is-element": "^3.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-rItO/pSdvnvsP4QRB1pmPiNHUskikqtPojZKJPPPAVx9Hj8i8TwMBhofrrAYRhYOOBZH9tgmG5lPqDLuIWPWmw=="],++ "rehype-ignore": ["[email protected]", "", { "dependencies": { "hast-util-select": "^6.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-IzhP6/u/6sm49sdktuYSmeIuObWB+5yC/5eqVws8BhuGA9kY25/byz6uCy/Ravj6lXUShEd2ofHM5MyAIj86Sg=="],+"rehype-parse": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="],+ "rehype-prism-plus": ["[email protected]", "", { "dependencies": { "hast-util-to-string": "^3.0.1", "parse-numeric-range": "^1.3.0", "refractor": "^5.0.0", "rehype-parse": "^9.0.1", "unist-util-filter": "^5.0.1", "unist-util-visit": "^5.1.0" } }, "sha512-jTHb8ZtQHd2VWAAKeCINgv/8zNEF0+LesmwJak69GemoPVN9/8fGEARTvqOpKqmN57HwaM9z8UKBVNVJe8zggw=="],+"rehype-raw": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="],"rehype-recma": ["[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "hast-util-to-estree": "^3.0.0" } }, "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw=="],+ "rehype-rewrite": ["[email protected]", "", { "dependencies": { "hast-util-select": "^6.0.0", "unified": "^11.0.3", "unist-util-visit": "^5.0.0" } }, "sha512-L/FO96EOzSA6bzOam4DVu61/PB3AGKcSPXpa53yMIozoxH4qg1+bVZDF8zh1EsuxtSauAhzt5cCnvoplAaSLrw=="],++ "rehype-slug": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "github-slugger": "^2.0.0", "hast-util-heading-rank": "^3.0.0", "hast-util-to-string": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A=="],+"rehype-stringify": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-html": "^9.0.0", "unified": "^11.0.0" } }, "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA=="],"remark-gfm": ["[email protected]", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg=="],+ "remark-github-blockquote-alert": ["[email protected]", "", { "dependencies": { "unist-util-visit": "^5.0.0" } }, "sha512-OPNnimcKeozWN1w8KVQEuHOxgN3L4rah8geMOLhA5vN9wITqU4FWD+G26tkEsCGHiOVDbISx+Se5rGZ+D1p0Jg=="],+"remark-mdx": ["[email protected]", "", { "dependencies": { "mdast-util-mdx": "^3.0.0", "micromark-extension-mdxjs": "^3.0.0" } }, "sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg=="],"remark-parse": ["[email protected]", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", "micromark-util-types": "^2.0.0", "unified": "^11.0.0" } }, "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA=="],@@ -2089,6 +2134,8 @@"unique-string": ["[email protected]", "", { "dependencies": { "crypto-random-string": "^2.0.0" } }, "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg=="],+ "unist-util-filter": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-pHx7D4Zt6+TsfwylH9+lYhBhzyhEnCXs/lbq/Hstxno5z4gVdyc2WEW0asfjGKPyG4pEKrnBv5hdkO6+aRnQJw=="],+"unist-util-find-after": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ=="],"unist-util-is": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g=="],@@ -2381,6 +2428,8 @@"readdirp/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],+ "rehype-attr/unist-util-visit": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg=="],+"sitemap/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],"source-map-support/source-map": ["[email protected]", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],diff --git a/package.json b/package.jsonindex 413f3051..9182ef90 100644--- a/package.json+++ b/package.json@@ -58,6 +58,7 @@"@tiptap/extension-placeholder": "latest","@tiptap/react": "latest","@tiptap/starter-kit": "latest",+ "@uiw/react-md-editor": "^4.1.1","class-variance-authority": "latest","clsx": "latest","cmdk": "^1.1.1",