Skip to content

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

feat(mobile): improve editor performance and mobile parity

tianma-ifb70a08bff0b5
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 8796f4e8..29bdabae 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -20,6 +20,10 @@
"@tanstack/query-async-storage-persister": "^5.101.2",
"@tanstack/react-query": "latest",
"@tanstack/react-query-persist-client": "^5.101.2",
+ "@tiptap/extension-image": "3.27.1",
+ "@tiptap/extension-placeholder": "3.27.1",
+ "@tiptap/react": "3.27.1",
+ "@tiptap/starter-kit": "3.27.1",
"expo": "~57.0.7",
"expo-build-properties": "~57.0.6",
"expo-clipboard": "~57.0.1",
@@ -32,6 +36,7 @@
"expo-sqlite": "~57.0.1",
"expo-status-bar": "latest",
"react": "19.2.3",
+ "react-dom": "19.2.3",
"react-native": "latest",
"react-native-gesture-handler": "~2.32.0",
"react-native-markdown-display": "^7.0.2",
@@ -39,7 +44,7 @@
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-svg": "15.15.4",
- "react-native-webview": "13.16.1"
+ "react-native-web": "~0.21.0"
},
"devDependencies": {
"@types/react": "latest",
diff --git a/apps/mobile/src/components/LazyWebView.tsx b/apps/mobile/src/components/LazyWebView.tsx
deleted file mode 100644
index 9b287035..00000000
--- a/apps/mobile/src/components/LazyWebView.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { WebView as default } from "react-native-webview";
diff --git a/apps/mobile/src/components/LocalTiptapEditor.tsx b/apps/mobile/src/components/LocalTiptapEditor.tsx
new file mode 100644
index 00000000..e0520cd1
--- /dev/null
+++ b/apps/mobile/src/components/LocalTiptapEditor.tsx
@@ -0,0 +1,234 @@
+'use dom';
+
+import Image from "@tiptap/extension-image";
+import Placeholder from "@tiptap/extension-placeholder";
+import { EditorContent, useEditor, useEditorState } from "@tiptap/react";
+import StarterKit from "@tiptap/starter-kit";
+import type { TiptapDoc } from "@edgeever/shared";
+import { useDOMImperativeHandle, type DOMImperativeFactory, type DOMProps } from "expo/dom";
+import { useCallback, useEffect, useRef, type Ref } from "react";
+
+type EditorDoc = TiptapDoc;
+
+type PickedImage = {
+ alt: string;
+ url: string;
+};
+
+export interface LocalTiptapEditorRef extends DOMImperativeFactory {
+ flush: () => void;
+ focus: () => void;
+}
+
+type LocalTiptapEditorProps = {
+ baseUrl: string;
+ content: EditorDoc;
+ dom?: DOMProps;
+ onChange: (content: EditorDoc) => Promise<void>;
+ onPickImage: () => Promise<PickedImage | null>;
+ onReady: (startupMs: number) => Promise<void>;
+ ref: Ref<LocalTiptapEditorRef>;
+};
+
+const CHANGE_IDLE_MS = 500;
+
+export default function LocalTiptapEditor(props: LocalTiptapEditorProps) {
+ const startedAtRef = useRef(performance.now());
+ const changeTimerRef = useRef<number | null>(null);
+ const onChangeRef = useRef(props.onChange);
+ const onPickImageRef = useRef(props.onPickImage);
+ const onReadyRef = useRef(props.onReady);
+
+ onChangeRef.current = props.onChange;
+ onPickImageRef.current = props.onPickImage;
+ onReadyRef.current = props.onReady;
+
+ const editor = useEditor({
+ extensions: [
+ StarterKit,
+ Image.configure({
+ allowBase64: false,
+ inline: false,
+ }),
+ Placeholder.configure({
+ placeholder: "开始记录...",
+ }),
+ ],
+ content: resolveImageSources(props.content, props.baseUrl),
+ editorProps: {
+ attributes: {
+ autocapitalize: "sentences",
+ autocomplete: "on",
+ autocorrect: "on",
+ class: "edgeever-editor-content",
+ inputmode: "text",
+ spellcheck: "true",
+ },
+ },
+ onUpdate: ({ editor: activeEditor }) => {
+ if (changeTimerRef.current !== null) {
+ window.clearTimeout(changeTimerRef.current);
+ }
+ changeTimerRef.current = window.setTimeout(() => {
+ changeTimerRef.current = null;
+ void onChangeRef.current(normalizeImageSources(activeEditor.getJSON() as EditorDoc, props.baseUrl));
+ }, CHANGE_IDLE_MS);
+ },
+ });
+
+ const flush = useCallback(() => {
+ if (!editor || editor.isDestroyed) {
+ return;
+ }
+ if (changeTimerRef.current !== null) {
+ window.clearTimeout(changeTimerRef.current);
+ changeTimerRef.current = null;
+ }
+ void onChangeRef.current(normalizeImageSources(editor.getJSON() as EditorDoc, props.baseUrl));
+ }, [editor, props.baseUrl]);
+
+ useDOMImperativeHandle(
+ props.ref,
+ () => ({
+ flush,
+ focus: () => editor?.commands.focus(),
+ }),
+ [editor, flush]
+ );
+
+ useEffect(() => {
+ if (!editor) {
+ return;
+ }
+
+ void onReadyRef.current(Math.round(performance.now() - startedAtRef.current));
+ const handlePageHide = () => flush();
+ const handleVisibilityChange = () => {
+ if (document.visibilityState === "hidden") {
+ flush();
+ }
+ };
+ window.addEventListener("pagehide", handlePageHide);
+ document.addEventListener("visibilitychange", handleVisibilityChange);
+
+ return () => {
+ window.removeEventListener("pagehide", handlePageHide);
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
+ if (changeTimerRef.current !== null) {
+ window.clearTimeout(changeTimerRef.current);
+ }
+ };
+ }, [editor, flush]);
+
+ const toolbarState = useEditorState({
+ editor,
+ selector: ({ editor: activeEditor }) =>
+ (activeEditor?.isActive("bold") ? 1 : 0) |
+ (activeEditor?.isActive("italic") ? 2 : 0) |
+ (activeEditor?.isActive("heading", { level: 2 }) ? 4 : 0) |
+ (activeEditor?.isActive("bulletList") ? 8 : 0) |
+ (activeEditor?.isActive("blockquote") ? 16 : 0) |
+ (activeEditor?.isActive("codeBlock") ? 32 : 0),
+ });
+
+ const insertImage = async () => {
+ if (!editor) {
+ return;
+ }
+ const image = await onPickImageRef.current();
+ if (image) {
+ editor.chain().focus().setImage({ alt: image.alt, src: resolveUrl(image.url, props.baseUrl) }).run();
+ }
+ };
+
+ return (
+ <div className="edgeever-editor-shell">
+ <style>{EDITOR_STYLES}</style>
+ <div aria-label="编辑器工具栏" className="edgeever-editor-toolbar" role="toolbar">
+ <ToolbarButton active={Boolean(toolbarState & 4)} label="标题" onRun={() => editor?.chain().focus().toggleHeading({ level: 2 }).run()} text="H2" />
+ <ToolbarButton active={Boolean(toolbarState & 1)} label="加粗" onRun={() => editor?.chain().focus().toggleBold().run()} text="B" />
+ <ToolbarButton active={Boolean(toolbarState & 2)} label="斜体" onRun={() => editor?.chain().focus().toggleItalic().run()} text="I" />
+ <ToolbarButton active={Boolean(toolbarState & 8)} label="无序列表" onRun={() => editor?.chain().focus().toggleBulletList().run()} text="•" />
+ <ToolbarButton active={Boolean(toolbarState & 16)} label="引用" onRun={() => editor?.chain().focus().toggleBlockquote().run()} text="❝" />
+ <ToolbarButton active={Boolean(toolbarState & 32)} label="代码块" onRun={() => editor?.chain().focus().toggleCodeBlock().run()} text="&lt;/&gt;" />
+ <ToolbarButton label="分割线" onRun={() => editor?.chain().focus().setHorizontalRule().run()} text="—" />
+ <ToolbarButton label="插入图片" onRun={() => void insertImage()} text="+图" />
+ <ToolbarButton label="撤销" onRun={() => editor?.chain().focus().undo().run()} text="↶" />
+ <ToolbarButton label="重做" onRun={() => editor?.chain().focus().redo().run()} text="↷" />
+ </div>
+ <EditorContent editor={editor} />
+ </div>
+ );
+}
+
+const ToolbarButton = ({ active = false, label, onRun, text }: { active?: boolean; label: string; onRun: () => void; text: string }) => (
+ <button
+ aria-label={label}
+ className={active ? "is-active" : undefined}
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={onRun}
+ type="button"
+ >
+ {text}
+ </button>
+);
+
+const mapImageSources = (doc: EditorDoc, mapSource: (source: string) => string): EditorDoc => {
+ const visit = (value: unknown): unknown => {
+ if (Array.isArray(value)) {
+ return value.map(visit);
+ }
+ if (!value || typeof value !== "object") {
+ return value;
+ }
+ const node = value as Record<string, unknown>;
+ const next = Object.fromEntries(Object.entries(node).map(([key, child]) => [key, visit(child)]));
+ if (node.type === "image" && next.attrs && typeof next.attrs === "object") {
+ const attrs = next.attrs as Record<string, unknown>;
+ if (typeof attrs.src === "string") {
+ next.attrs = { ...attrs, src: mapSource(attrs.src) };
+ }
+ }
+ return next;
+ };
+
+ return visit(doc) as EditorDoc;
+};
+
+const resolveImageSources = (doc: EditorDoc, baseUrl: string) => mapImageSources(doc, (source) => resolveUrl(source, baseUrl));
+
+const normalizeImageSources = (doc: EditorDoc, baseUrl: string) => {
+ const normalizedBaseUrl = baseUrl.replace(/\/+$/, "");
+ return mapImageSources(doc, (source) => source.startsWith(`${normalizedBaseUrl}/`) ? source.slice(normalizedBaseUrl.length) : source);
+};
+
+const resolveUrl = (source: string, baseUrl: string) => {
+ if (!source.startsWith("/")) {
+ return source;
+ }
+ return `${baseUrl.replace(/\/+$/, "")}${source}`;
+};
+
+const EDITOR_STYLES = `
+ :root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
+ * { box-sizing: border-box; }
+ html, body, #root { width: 100%; height: 100%; margin: 0; background: #fff; }
+ body { overflow: hidden; color: #0f172a; }
+ .edgeever-editor-shell { display: flex; height: 100%; min-height: 100%; flex-direction: column; background: #fff; }
+ .edgeever-editor-toolbar { display: flex; flex: 0 0 auto; gap: 6px; overflow-x: auto; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; scrollbar-width: none; }
+ .edgeever-editor-toolbar::-webkit-scrollbar { display: none; }
+ .edgeever-editor-toolbar button { min-width: 38px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: #fff; color: #475569; font: inherit; font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 1px #e2e8f0; }
+ .edgeever-editor-toolbar button.is-active { background: #ccfbf1; color: #0f766e; box-shadow: inset 0 0 0 1px #5eead4; }
+ .tiptap { min-height: 100%; outline: none; }
+ .edgeever-editor-shell > div:last-child { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
+ .edgeever-editor-content { min-height: 100%; padding: 18px 18px 40vh; font-size: 17px; line-height: 1.7; word-break: break-word; caret-color: #0f766e; }
+ .edgeever-editor-content > :first-child { margin-top: 0; }
+ .edgeever-editor-content p.is-editor-empty:first-child::before { float: left; height: 0; color: #94a3b8; content: attr(data-placeholder); pointer-events: none; }
+ .edgeever-editor-content h1, .edgeever-editor-content h2, .edgeever-editor-content h3 { line-height: 1.3; }
+ .edgeever-editor-content blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid #5eead4; color: #475569; }
+ .edgeever-editor-content pre { overflow-x: auto; border-radius: 10px; padding: 14px; background: #0f172a; color: #e2e8f0; }
+ .edgeever-editor-content code { border-radius: 4px; padding: 2px 4px; background: #f1f5f9; }
+ .edgeever-editor-content pre code { padding: 0; background: transparent; }
+ .edgeever-editor-content img { display: block; max-width: 100%; height: auto; margin: 14px auto; border-radius: 10px; }
+ .edgeever-editor-content hr { margin: 24px 0; border: 0; border-top: 1px solid #cbd5e1; }
+`;
diff --git a/apps/mobile/src/lib/local-mirror.ts b/apps/mobile/src/lib/local-mirror.ts
index ff3489d8..1f01106b 100644
--- a/apps/mobile/src/lib/local-mirror.ts
+++ b/apps/mobile/src/lib/local-mirror.ts
@@ -22,6 +22,7 @@ export type LocalMemoListParams = {
sort?: MemoSortMode;
filter?: MemoFilterMode;
limit?: number;
+ offset?: number;
};
export const createMobileDataScope = (baseUrl: string, userId?: string | null) =>
@@ -86,16 +87,21 @@ export const listLocalMemos = async (scope: string, params: LocalMemoListParams)
`SELECT COUNT(*) AS count FROM mobile_memos WHERE ${conditions.join(" AND ")}`,
...binds
);
+ const limit = params.limit ?? 50;
+ const offset = Math.max(0, params.offset ?? 0);
const rows = await db.getAllAsync<StoredMemoRow>(
- `SELECT data_json FROM mobile_memos WHERE ${conditions.join(" AND ")} ORDER BY ${orderBy} LIMIT ?`,
+ `SELECT data_json FROM mobile_memos WHERE ${conditions.join(" AND ")} ORDER BY ${orderBy} LIMIT ? OFFSET ?`,
...binds,
- params.limit ?? 50
+ limit,
+ offset
);
+ const totalCount = countRow?.count ?? rows.length;
+ const nextOffset = offset + rows.length;
return {
memos: rows.map((row) => toMemoSummary(JSON.parse(row.data_json) as MemoDetail)),
- totalCount: countRow?.count ?? rows.length,
- nextCursor: null,
+ totalCount,
+ nextCursor: nextOffset < totalCount ? String(nextOffset) : null,
};
};
diff --git a/apps/mobile/src/lib/mobile-drafts.ts b/apps/mobile/src/lib/mobile-drafts.ts
index ce93dda6..d5ddaba3 100644
--- a/apps/mobile/src/lib/mobile-drafts.ts
+++ b/apps/mobile/src/lib/mobile-drafts.ts
@@ -1,6 +1,7 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
const MOBILE_DRAFT_PREFIX = "edgeever.mobile.memoDraft:";
+const MOBILE_NEW_DRAFT_PREFIX = "edgeever.mobile.newMemoDraft:";
export type MobileMemoDraft = {
memoId: string;
@@ -12,6 +13,14 @@ export type MobileMemoDraft = {
updatedAt: string;
};
+export type MobileNewMemoDraft = {
+ title: string;
+ contentMarkdown: string;
+ notebookId: string;
+ tagsText: string;
+ updatedAt: string;
+};
+
export const readMobileMemoDraft = async (memoId: string): Promise<MobileMemoDraft | null> => {
const rawValue = await AsyncStorage.getItem(getMobileMemoDraftKey(memoId));
@@ -31,7 +40,26 @@ export const writeMobileMemoDraft = (draft: MobileMemoDraft) => AsyncStorage.set
export const clearMobileMemoDraft = (memoId: string) => AsyncStorage.removeItem(getMobileMemoDraftKey(memoId));
+export const readMobileNewMemoDraft = async (scope: string): Promise<MobileNewMemoDraft | null> => {
+ const rawValue = await AsyncStorage.getItem(getMobileNewMemoDraftKey(scope));
+ if (!rawValue) {
+ return null;
+ }
+ try {
+ const parsed = JSON.parse(rawValue);
+ return isMobileNewMemoDraft(parsed) ? parsed : null;
+ } catch {
+ return null;
+ }
+};
+
+export const writeMobileNewMemoDraft = (scope: string, draft: MobileNewMemoDraft) =>
+ AsyncStorage.setItem(getMobileNewMemoDraftKey(scope), JSON.stringify(draft));
+
+export const clearMobileNewMemoDraft = (scope: string) => AsyncStorage.removeItem(getMobileNewMemoDraftKey(scope));
+
const getMobileMemoDraftKey = (memoId: string) => `${MOBILE_DRAFT_PREFIX}${memoId}`;
+const getMobileNewMemoDraftKey = (scope: string) => `${MOBILE_NEW_DRAFT_PREFIX}${encodeURIComponent(scope)}`;
const isMobileMemoDraft = (value: unknown): value is MobileMemoDraft => {
if (!value || typeof value !== "object") {
@@ -49,3 +77,17 @@ const isMobileMemoDraft = (value: unknown): value is MobileMemoDraft => {
typeof draft.updatedAt === "string"
);
};
+
+const isMobileNewMemoDraft = (value: unknown): value is MobileNewMemoDraft => {
+ if (!value || typeof value !== "object") {
+ return false;
+ }
+ const draft = value as Partial<MobileNewMemoDraft>;
+ return (
+ typeof draft.title === "string" &&
+ typeof draft.contentMarkdown === "string" &&
+ typeof draft.notebookId === "string" &&
+ typeof draft.tagsText === "string" &&
+ typeof draft.updatedAt === "string"
+ );
+};
diff --git a/apps/mobile/src/lib/startup-performance.ts b/apps/mobile/src/lib/startup-performance.ts
index f3a85aed..5a309938 100644
--- a/apps/mobile/src/lib/startup-performance.ts
+++ b/apps/mobile/src/lib/startup-performance.ts
@@ -8,6 +8,7 @@ type NativeStartupTiming = {
};
const marks = new Map<StartupMark, number>();
+let latestEditorStartupMs: number | null = null;
export const markStartup = (name: StartupMark) => {
if (!marks.has(name)) {
@@ -15,6 +16,12 @@ export const markStartup = (name: StartupMark) => {
}
};
+export const recordEditorStartup = (durationMs: number) => {
+ if (Number.isFinite(durationMs) && durationMs >= 0) {
+ latestEditorStartupMs = durationMs;
+ }
+};
+
export const getStartupPerformanceItems = () => {
const nativeTiming = (performance as Performance & { rnStartupTiming?: NativeStartupTiming }).rnStartupTiming;
const nativeStart = nativeTiming?.startTime ?? 0;
@@ -32,5 +39,6 @@ export const getStartupPerformanceItems = () => {
{ label: "启动至工作区首帧", value: sinceNativeStart("workspace-first-commit") },
{ label: "启动至列表数据就绪", value: sinceNativeStart("workspace-data-ready") },
{ label: "启动至交互空闲", value: sinceNativeStart("workspace-interactive") },
+ { label: "最近一次本地编辑器启动", value: latestEditorStartupMs === null ? "尚未记录" : `${latestEditorStartupMs.toFixed(0)} ms` },
];
};
diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsx
index d2ecbf45..56c8f737 100644
--- a/apps/mobile/src/screens/WorkspaceScreen.tsx
+++ b/apps/mobile/src/screens/WorkspaceScreen.tsx
@@ -1,5 +1,5 @@
-import { createContext, lazy, memo, Suspense, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import { keepPreviousData, useMutation, useQuery, useQueryClient, type QueryClient, type UseMutationResult } from "@tanstack/react-query";
+import { createContext, memo, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
+import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient, type InfiniteData, type QueryClient, type UseMutationResult } from "@tanstack/react-query";
import * as Clipboard from "expo-clipboard";
import Constants from "expo-constants";
import type { DocumentPickerAsset } from "expo-document-picker";
@@ -58,6 +58,7 @@ import {
import {
ActivityIndicator,
Alert,
+ BackHandler,
AppState,
type AppStateStatus,
FlatList,
@@ -77,8 +78,8 @@ import {
} from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import Markdown from "react-native-markdown-display";
-import { createExcerpt, docToText, getNotebookDescendantIds, markdownToDoc, type ApiToken, type MemoDetail, type MemoRevision, type MemoSummary, type Notebook, type ResourceListItem, type TagSummary } from "@edgeever/shared";
-import { clearMobileMemoDraft, readMobileMemoDraft, writeMobileMemoDraft } from "../lib/mobile-drafts";
+import { createExcerpt, docToMarkdown, docToText, getNotebookDescendantIds, markdownToDoc, type ApiToken, type MemoDetail, type MemoRevision, type MemoSummary, type Notebook, type ResourceListItem, type TagSummary, type TiptapDoc } from "@edgeever/shared";
+import { clearMobileMemoDraft, clearMobileNewMemoDraft, readMobileMemoDraft, readMobileNewMemoDraft, writeMobileMemoDraft, writeMobileNewMemoDraft } from "../lib/mobile-drafts";
import {
readMobileImageCompressionEnabled,
readMobileLocalePreference,
@@ -119,10 +120,10 @@ import {
upsertLocalMemo,
} from "../lib/local-mirror";
import { AccountSecurityModal } from "./AccountSecurityModal";
-import { getStartupPerformanceItems, markStartup } from "../lib/startup-performance";
+import { getStartupPerformanceItems, markStartup, recordEditorStartup } from "../lib/startup-performance";
+import LocalTiptapEditor, { type LocalTiptapEditorRef } from "../components/LocalTiptapEditor";
const ALL_NOTES_ID = "all";
-const LazyWebView = lazy(() => import("../components/LazyWebView"));
const DEFAULT_MEMO_TITLE = "无标题笔记";
const MOBILE_APP_VERSION = Constants.expoConfig?.version ?? "0.1.2";
const GITHUB_REPOSITORY_URL = "https://github.com/tianma-if/edgeever";
@@ -309,6 +310,15 @@ type TextSelection = {
end: number;
};
type MarkdownAction = "heading" | "bold" | "italic" | "bullet" | "checklist" | "quote" | "code" | "link" | "horizontalRule";
+type MobileMemoUpdatePayload = {
+ title?: string;
+ contentJson?: TiptapDoc;
+ contentMarkdown?: string;
+ isPinned?: boolean;
+ notebookId?: string;
+ tags?: string[];
+};
+type MobileMemoUpdateMutation = UseMutationResult<MemoDetail, Error, { memo: MemoDetail; payload: MobileMemoUpdatePayload }>;
export const WorkspaceScreen = () => {
const { client, session, signOut } = useSession();
@@ -380,9 +390,10 @@ export const WorkspaceScreen = () => {
[activeNotebookId, notebooks]
);
- const memosQuery = useQuery({
- queryKey: ["mobile", "memos", memoView, activeNotebookId, memoFilterMode, memoSortMode, activeNotebookDescendantIds],
- queryFn: async () => {
+ const memosQuery = useInfiniteQuery({
+ queryKey: ["mobile", "memos", memoView, activeNotebookId, memoFilterMode, memoSortMode, activeNotebookDescendantIds, "paged-v2"],
+ initialPageParam: 0,
+ queryFn: async ({ pageParam }) => {
if (!client) {
throw new Error("Client is not ready");
}
@@ -391,17 +402,20 @@ export const WorkspaceScreen = () => {
notebookIds: activeNotebookDescendantIds,
filter: memoFilterMode,
limit: 50,
+ offset: pageParam,
sort: memoSortMode,
trash: memoView === "trash",
});
},
+ getNextPageParam: (lastPage) => lastPage.nextCursor ? Number(lastPage.nextCursor) : undefined,
enabled: Boolean(client),
placeholderData: keepPreviousData,
});
- const searchQuery = useQuery({
- queryKey: ["mobile", "search", debouncedSearchText],
- queryFn: async () => {
+ const searchQuery = useInfiniteQuery({
+ queryKey: ["mobile", "search", debouncedSearchText, "paged-v2"],
+ initialPageParam: 0,
+ queryFn: async ({ pageParam }) => {
if (!client) {
throw new Error("Client is not ready");
}
@@ -409,9 +423,11 @@ export const WorkspaceScreen = () => {
return listLocalMemos(dataScope, {
q: debouncedSearchText,
limit: 50,
+ offset: pageParam,
sort: "updated-desc",
});
},
+ getNextPageParam: (lastPage) => lastPage.nextCursor ? Number(lastPage.nextCursor) : undefined,
enabled: Boolean(client && debouncedSearchText.length > 0),
placeholderData: keepPreviousData,
});
@@ -440,6 +456,34 @@ export const WorkspaceScreen = () => {
return () => task.cancel();
}, []);
+ useEffect(() => {
+ const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
+ if (selectedMemoId) {
+ setSelectedMemoId(null);
+ return true;
+ }
+ if (selectionMode) {
+ setSelectionMode(false);
+ setSelectedMemoIds(new Set());
+ setSelectionMoveOpen(false);
+ return true;
+ }
+ if (activeView !== "notes") {
+ if (activeView === "search") {
+ setSearchText("");
+ }
+ setActiveView("notes");
+ return true;
+ }
+ if (memoView === "trash") {
+ setMemoView("notebook");
+ return true;
+ }
+ return false;
+ });
+ return () => subscription.remove();
+ }, [activeView, memoView, selectedMemoId, selectionMode]);
+
useEffect(() => {
if (notebooksQuery.data && memosQuery.data) {
markStartup("workspace-data-ready");
@@ -469,11 +513,7 @@ export const WorkspaceScreen = () => {
};
const handleSearchMemoPress = (memo: MemoSummary) => {
- setActiveView("notes");
setMemoView(memo.isDeleted ? "trash" : "notebook");
- if (!memo.isDeleted) {
- setActiveNotebookId(memo.notebookId);
- }
setSelectedMemoId(memo.id);
};
@@ -536,12 +576,11 @@ export const WorkspaceScreen = () => {
if (memoId) {
setSelectedMemoId(memoId);
}
- void invalidateWorkspace();
};
const memoCount = notebooks.reduce((total, notebook) => total + notebook.memoCount, 0);
- const memos = memosQuery.data?.memos ?? [];
- const searchResults = searchQuery.data?.memos ?? [];
+ const memos = useMemo(() => memosQuery.data?.pages.flatMap((page) => page.memos) ?? [], [memosQuery.data]);
+ const searchResults = useMemo(() => searchQuery.data?.pages.flatMap((page) => page.memos) ?? [], [searchQuery.data]);
const selectedMemo = memoDetailQuery.data?.memo ?? null;
const isRefreshing = notebooksQuery.isFetching || memosQuery.isFetching || searchQuery.isFetching || memoDetailQuery.isFetching;
const selectedMemoIdList = Array.from(selectedMemoIds);
@@ -667,7 +706,7 @@ export const WorkspaceScreen = () => {
};
const updateMemoMutation = useMutation({
- mutationFn: async ({ memo, payload }: { memo: MemoDetail; payload: { title?: string; contentMarkdown?: string; isPinned?: boolean; notebookId?: string; tags?: string[] } }) => {
+ mutationFn: async ({ memo, payload }: { memo: MemoDetail; payload: MobileMemoUpdatePayload }) => {
if (!client) {
throw new Error("Client is not ready");
}
@@ -695,7 +734,7 @@ export const WorkspaceScreen = () => {
});
const localUpdateMemoMutation = useMutation({
- mutationFn: async ({ memo, payload }: { memo: MemoDetail; payload: { title?: string; contentMarkdown?: string; isPinned?: boolean; notebookId?: string; tags?: string[] } }) => {
+ mutationFn: async ({ memo, payload }: { memo: MemoDetail; payload: MobileMemoUpdatePayload }) => {
const syncBaseMemo = await resolveLocalMemo(dataScope, memo.id) ?? memo;
const optimisticMemo = createOptimisticMemo(syncBaseMemo, payload);
@@ -1083,6 +1122,7 @@ export const WorkspaceScreen = () => {
<NotesView
activeNotebook={activeNotebook}
isLoading={memosQuery.isLoading}
+ isLoadingMore={memosQuery.isFetchingNextPage}
isRefreshing={isRefreshing}
memoFilterMode={memoFilterMode}
memoListDensity={memoListDensity}
@@ -1095,7 +1135,12 @@ export const WorkspaceScreen = () => {
onOpenNotebookPicker={() => setNotebookPickerOpen(true)}
onOpenSearch={() => setActiveView("search")}
onMemoPress={handleMemoPress}
- onMemoLongPress={(memo) => setMemoActionsMemo(memo)}
+ onMemoLongPress={(memo) => selectSingleMemo(memo.id)}
+ onLoadMore={() => {
+ if (memosQuery.hasNextPage && !memosQuery.isFetchingNextPage) {
+ void memosQuery.fetchNextPage();
+ }
+ }}
onRefresh={refresh}
onSetMemoView={setMemoView}
selectionMode={selectionMode}
@@ -1107,7 +1152,10 @@ export const WorkspaceScreen = () => {
{activeView === "search" ? (
<SearchView
- isLoading={searchQuery.isFetching}
+ error={searchQuery.error}
+ isError={searchQuery.isError}
+ isLoading={searchQuery.isLoading}
+ isLoadingMore={searchQuery.isFetchingNextPage}
isRefreshing={isRefreshing}
onClose={() => {
setSearchText("");
@@ -1115,10 +1163,15 @@ export const WorkspaceScreen = () => {
}}
onMemoPress={handleSearchMemoPress}
onRefresh={refresh}
+ onLoadMore={() => {
+ if (searchQuery.hasNextPage && !searchQuery.isFetchingNextPage) {
+ void searchQuery.fetchNextPage();
+ }
+ }}
results={searchResults}
searchText={searchText}
setSearchText={setSearchText}
- totalCount={searchQuery.data?.totalCount ?? searchResults.length}
+ totalCount={searchQuery.data?.pages[0]?.totalCount ?? searchResults.length}
/>
) : null}
@@ -1176,7 +1229,14 @@ export const WorkspaceScreen = () => {
}}
updateMutation={localUpdateMemoMutation}
/> : null}
- {richEditingMemo ? <RichEditorModal baseUrl={session?.baseUrl ?? ""} memo={richEditingMemo} notebooks={notebooks} onClose={closeRichEditor} token={session?.token ?? ""} /> : null}
+ {richEditingMemo ? <RichEditorModal
+ baseUrl={session?.baseUrl ?? ""}
+ imageCompressionEnabled={imageCompressionEnabled}
+ memo={richEditingMemo}
+ notebooks={notebooks}
+ onClose={closeRichEditor}
+ updateMutation={localUpdateMemoMutation}
+ /> : null}
{notebookPickerOpen ? <NotebookPickerModal
activeNotebookId={activeNotebookId}
notebookSortMode={notebookSortMode}
@@ -1222,6 +1282,7 @@ export const WorkspaceScreen = () => {
{createOpen ? <CreateMemoModal
activeNotebookId={activeNotebookId}
+ baseUrl={session?.baseUrl ?? ""}
dataScope={dataScope}
notebooks={notebooks}
onClose={() => setCreateOpen(false)}
@@ -1359,6 +1420,7 @@ export const WorkspaceScreen = () => {
onPress={() => setActiveView("notes")}
/>
<Pressable
+ accessibilityLabel="新建笔记"
accessibilityRole="button"
disabled={!canCreateMemo}
onPress={() => setCreateOpen(true)}
@@ -1383,6 +1445,7 @@ const NotesView = ({
error,
isError,
isLoading,
+ isLoadingMore,
isRefreshing,
memoFilterMode,
memoListDensity,
@@ -1396,6 +1459,7 @@ const NotesView = ({
onOpenSearch,
onMemoLongPress,
onMemoPress,
+ onLoadMore,
onRefresh,
onSetMemoView,
selectedMemoIds,
@@ -1405,6 +1469,7 @@ const NotesView = ({
error: unknown;
isError: boolean;
isLoading: boolean;
+ isLoadingMore: boolean;
isRefreshing: boolean;
memoFilterMode: MemoFilterMode;
memoListDensity: MobileMemoListDensity;
@@ -1418,6 +1483,7 @@ const NotesView = ({
onOpenSearch: () => void;
onMemoLongPress: (memo: MemoSummary) => void;
onMemoPress: (memoId: string) => void;
+ onLoadMore: () => void;
onRefresh: () => void;
onSetMemoView: (memoView: MemoView) => void;
selectionMode: boolean;
@@ -1428,6 +1494,7 @@ const NotesView = ({
<View style={styles.mobileListHeader}>
<View style={styles.mobileListTitleRow}>
<Pressable
+ accessibilityLabel={memoView === "trash" ? "返回笔记列表" : "选择笔记本"}
accessibilityRole="button"
onPress={memoView === "trash" ? () => onSetMemoView("notebook") : onOpenNotebookPicker}
style={styles.mobileNotebookTitleButton}
@@ -1438,14 +1505,14 @@ const NotesView = ({
</Text>
{memoView === "notebook" ? <ChevronDown color="#64748b" size={16} /> : null}
</Pressable>
- <Pressable accessibilityRole="button" onPress={onOpenActions} style={styles.mobileMoreButton}>
+ <Pressable accessibilityLabel="笔记列表操作" accessibilityRole="button" onPress={onOpenActions} style={styles.mobileMoreButton}>
<MoreHorizontal color="#475569" size={20} />
</Pressable>
</View>
{memoView === "notebook" ? (
<View style={styles.mobileSearchRow}>
- <Pressable accessibilityRole="button" onPress={onOpenSearch} style={styles.mobileSearchButton}>
+ <Pressable accessibilityLabel="搜索笔记" accessibilityRole="button" onPress={onOpenSearch} style={styles.mobileSearchButton}>
<Search color="#64748b" size={17} />
<Text style={styles.mobileSearchPlaceholder}>搜索笔记</Text>
</Pressable>
@@ -1478,12 +1545,15 @@ const NotesView = ({
error={error}
isError={isError}
isLoading={isLoading}
+ isLoadingMore={isLoadingMore}
isRefreshing={isRefreshing}
listDensity={memoListDensity}
memos={memos}
onMemoLongPress={onMemoLongPress}
onMemoPress={onMemoPress}
+ onLoadMore={onLoadMore}
onRefresh={onRefresh}
+ onRetry={onRefresh}
selectionMode={selectionMode}
selectedMemoIds={selectedMemoIds}
/>
@@ -1736,20 +1806,28 @@ const ActionSheetItem = ({ danger = false, disabled = false, icon, label, onPres
);
const SearchView = ({
+ error,
+ isError,
isLoading,
+ isLoadingMore,
isRefreshing,
onClose,
onMemoPress,
+ onLoadMore,
onRefresh,
results,
searchText,
setSearchText,
totalCount,
}: {
+ error?: unknown;
+ isError: boolean;
isLoading: boolean;
+ isLoadingMore: boolean;
isRefreshing: boolean;
onClose: () => void;
onMemoPress: (memo: MemoSummary) => void;
+ onLoadMore: () => void;
onRefresh: () => void;
results: MemoSummary[];
searchText: string;
@@ -1760,7 +1838,7 @@ const SearchView = ({
<View style={styles.searchHeader}>
<View style={styles.searchTitleRow}>
<Text style={styles.sectionTitle}>搜索</Text>
- <IconButton onPress={onClose}>
+ <IconButton accessibilityLabel="关闭搜索" onPress={onClose}>
<X color="#0f172a" size={20} />
</IconButton>
</View>
@@ -1776,7 +1854,7 @@ const SearchView = ({
value={searchText}
/>
{searchText ? (
- <Pressable onPress={() => setSearchText("")}>
+ <Pressable accessibilityLabel="清空搜索" accessibilityRole="button" onPress={() => setSearchText("")}>
<X color="#64748b" size={18} />
</Pressable>
) : null}
@@ -1788,8 +1866,10 @@ const SearchView = ({
<MemoList
emptyDescription="换个关键词再试"
emptyTitle="没有找到匹配笔记"
- isError={false}
+ error={error}
+ isError={isError}
isLoading={isLoading}
+ isLoadingMore={isLoadingMore}
isRefreshing={isRefreshing}
listDensity="preview"
memos={results}
@@ -1799,13 +1879,15 @@ const SearchView = ({
onMemoPress(memo);
}
}}
+ onLoadMore={onLoadMore}
onRefresh={onRefresh}
+ onRetry={onRefresh}
/>
) : (
<View style={styles.centerState}>
<Search color="#94a3b8" size={32} />
<Text style={styles.emptyTitle}>输入关键词开始搜索</Text>
- <Text style={styles.mutedText}>搜索会请求你的 EdgeEver 实例</Text>
+ <Text style={styles.mutedText}>搜索本机同步缓存,结果会即时显示</Text>
</View>
)}
</View>
@@ -2039,6 +2121,7 @@ const SettingsLinkGroup = ({ description, icon, onPress, title }: { description:
const CreateMemoModal = ({
activeNotebookId,
+ baseUrl,
dataScope,
notebooks,
onClose,
@@ -2048,6 +2131,7 @@ const CreateMemoModal = ({
visible,
}: {
activeNotebookId: string;
+ baseUrl: string;
dataScope: string;
notebooks: Notebook[];
onClose: () => void;
@@ -2058,21 +2142,70 @@ const CreateMemoModal = ({
}) => {
const queryClient = useQueryClient();
const fallbackNotebookId = activeNotebookId !== ALL_NOTES_ID ? activeNotebookId : notebooks[0]?.id ?? "";
+ const editorRef = useRef<LocalTiptapEditorRef>(null);
+ const contentJsonRef = useRef<TiptapDoc>(markdownToDoc(""));
+ const contentMarkdownRef = useRef("");
+ const dirtyRef = useRef(false);
const [notebookId, setNotebookId] = useState(fallbackNotebookId);
const [title, setTitle] = useState("");
const [tagsText, setTagsText] = useState("");
const [contentMarkdown, setContentMarkdown] = useState("");
- const [contentSelection, setContentSelection] = useState<TextSelection>({ start: 0, end: 0 });
const [notebookPickerOpen, setNotebookPickerOpen] = useState(false);
+ const [draftLoaded, setDraftLoaded] = useState(false);
+ const [draftRestored, setDraftRestored] = useState(false);
+ const [dirty, setDirty] = useState(false);
+ const [editorReady, setEditorReady] = useState(false);
const targetNotebookId = notebookId || fallbackNotebookId;
const selectedNotebookName = notebooks.find((notebook) => notebook.id === targetNotebookId)?.name ?? "选择笔记本";
useEffect(() => {
- if (visible) {
- setNotebookId(fallbackNotebookId);
+ if (!visible) {
+ return;
}
+ let active = true;
+ setDraftLoaded(false);
+ setDraftRestored(false);
+ setEditorReady(false);
+ void readMobileNewMemoDraft(dataScope).then((draft) => {
+ if (!active) {
+ return;
+ }
+ const restoredNotebookId = draft && notebooks.some((notebook) => notebook.id === draft.notebookId)
+ ? draft.notebookId
+ : fallbackNotebookId;
+ const markdown = draft?.contentMarkdown ?? "";
+ contentMarkdownRef.current = markdown;
+ contentJsonRef.current = markdownToDoc(markdown);
+ dirtyRef.current = Boolean(draft);
+ setTitle(draft?.title ?? "");
+ setTagsText(draft?.tagsText ?? "");
+ setContentMarkdown(markdown);
+ setNotebookId(restoredNotebookId);
+ setDirty(Boolean(draft));
+ setDraftRestored(Boolean(draft));
+ setDraftLoaded(true);
+ });
+ return () => {
+ active = false;
+ };
}, [fallbackNotebookId, visible]);
+ useEffect(() => {
+ if (!visible || !draftLoaded || !dirty) {
+ return;
+ }
+ const timeout = setTimeout(() => {
+ void writeMobileNewMemoDraft(dataScope, {
+ title,
+ contentMarkdown: contentMarkdownRef.current,
+ notebookId: targetNotebookId,
+ tagsText,
+ updatedAt: new Date().toISOString(),
+ });
+ }, 350);
+ return () => clearTimeout(timeout);
+ }, [dataScope, dirty, draftLoaded, tagsText, targetNotebookId, title, visible, contentMarkdown]);
+
const createMutation = useMutation({
mutationFn: async () => {
if (!targetNotebookId) {
@@ -2080,8 +2213,8 @@ const CreateMemoModal = ({
}
const now = new Date().toISOString();
const temporaryId = `local:${Date.now().toString(36)}:${Math.random().toString(36).slice(2, 10)}`;
- const markdown = contentMarkdown.trim();
- const contentJson = markdownToDoc(markdown);
+ const markdown = contentMarkdownRef.current.trim();
+ const contentJson = contentJsonRef.current;
const contentText = docToText(contentJson);
const memo: MemoDetail = {
id: temporaryId,
@@ -2123,47 +2256,113 @@ const CreateMemoModal = ({
setTitle("");
setTagsText("");
setContentMarkdown("");
+ contentMarkdownRef.current = "";
+ contentJsonRef.current = markdownToDoc("");
+ dirtyRef.current = false;
+ setDirty(false);
+ await clearMobileNewMemoDraft(dataScope);
await onQueued();
onCreated(memo);
},
});
const canSubmitCreateMemo = Boolean(targetNotebookId) && !createMutation.isPending;
- const insertImageLinkFromClipboard = async () => {
+ const pickImageLinkFromClipboard = async () => {
const text = await Clipboard.getStringAsync();
-
const url = text.trim();
if (!/^https?:\/\//i.test(url)) {
- Alert.alert("未找到图片链接", "请先复制一个以 http:// 或 https:// 开头的图片链接。");
- return;
+ Alert.alert("新建笔记暂未上传图片", "可以先复制图片链接插入;本地图片请在完成创建后上传。");
+ return null;
}
+ return { alt: "图片", url };
+ };
- const next = insertPlainText(contentMarkdown, contentSelection, `![图片](${url})`);
- setContentMarkdown(next.value);
- setContentSelection(next.selection);
+ const markDirty = () => {
+ dirtyRef.current = true;
+ setDirty(true);
};
- const applyCreateEditorAction = (action: MarkdownAction) => {
- const next = applyMarkdownAction(contentMarkdown, contentSelection, action);
- setContentMarkdown(next.value);
- setContentSelection(next.selection);
+ const requestClose = () => {
+ if (createMutation.isPending) {
+ return;
+ }
+ editorRef.current?.flush();
+ if (!dirtyRef.current) {
+ onClose();
+ return;
+ }
+ Alert.alert("退出新建笔记?", "内容已自动保存为本地草稿,下次新建时会继续恢复。", [
+ { text: "继续编辑", style: "cancel" },
+ {
+ text: "放弃草稿",
+ style: "destructive",
+ onPress: () => {
+ void clearMobileNewMemoDraft(dataScope);
+ dirtyRef.current = false;
+ onClose();
+ },
+ },
+ {
+ text: "保留并退出",
+ onPress: () => {
+ void writeMobileNewMemoDraft(dataScope, {
+ title,
+ contentMarkdown: contentMarkdownRef.current,
+ notebookId: targetNotebookId,
+ tagsText,
+ updatedAt: new Date().toISOString(),
+ });
+ onClose();
+ },
+ },
+ ]);
};
+ const editorElement = useMemo(() => draftLoaded && baseUrl ? (
+ <LocalTiptapEditor
+ baseUrl={baseUrl}
+ content={contentJsonRef.current}
+ dom={{
+ bounces: false,
+ contentInsetAdjustmentBehavior: "never",
+ overScrollMode: "never",
+ scrollEnabled: false,
+ style: styles.createMemoEditor,
+ }}
+ onChange={async (contentJson) => {
+ contentJsonRef.current = contentJson;
+ const markdown = docToMarkdown(contentJson);
+ contentMarkdownRef.current = markdown;
+ setContentMarkdown(markdown);
+ markDirty();
+ }}
+ onPickImage={pickImageLinkFromClipboard}
+ onReady={async (elapsedMs) => {
+ setEditorReady(true);
+ recordEditorStartup(elapsedMs);
+ }}
+ ref={editorRef}
+ />
+ ) : null, [baseUrl, draftLoaded]);
+
return (
- <Modal animationType="slide" onRequestClose={() => !createMutation.isPending && onClose()} presentationStyle="fullScreen" visible={visible}>
+ <Modal animationType="slide" onRequestClose={requestClose} presentationStyle="fullScreen" visible={visible}>
<SafeAreaView style={styles.createMemoSafeArea}>
<View style={styles.createMemoHeader}>
- <Pressable accessibilityLabel="返回" disabled={createMutation.isPending} onPress={onClose} style={styles.createMemoBackButton}>
+ <Pressable accessibilityLabel="返回" accessibilityRole="button" disabled={createMutation.isPending} onPress={requestClose} style={styles.createMemoBackButton}>
<ChevronLeft color={createMutation.isPending ? "#cbd5e1" : "#0f172a"} size={30} />
</Pressable>
<View style={styles.createMemoHeaderActions}>
<Text style={[styles.createMemoStatus, createMutation.isPending && styles.createMemoStatusActive]}>
- {createMutation.isPending ? "保存中" : "未保存"}
+ {createMutation.isPending ? "保存中" : dirty ? "本地草稿" : editorReady ? "已保存" : "正在启动"}
</Text>
<Pressable
accessibilityLabel="完成新建笔记"
disabled={!canSubmitCreateMemo}
- onPress={() => createMutation.mutate()}
+ onPress={() => {
+ editorRef.current?.flush();
+ createMutation.mutate();
+ }}
style={[styles.createMemoDoneButton, !canSubmitCreateMemo && styles.createMemoDoneButtonDisabled]}
>
{createMutation.isPending ? <ActivityIndicator color="#64748b" size="small" /> : <Text style={[styles.createMemoDoneText, !canSubmitCreateMemo && styles.createMemoDoneTextDisabled]}>完成</Text>}
@@ -2171,14 +2370,15 @@ const CreateMemoModal = ({
</View>
</View>
- <ScrollView
- contentContainerStyle={styles.createMemoMain}
- keyboardShouldPersistTaps="handled"
- style={styles.createMemoScroll}
- >
+ <View style={styles.createMemoMain}>
+ {draftRestored ? <Text style={styles.createMemoDraftNotice}>已恢复上次未完成的本地草稿</Text> : null}
<TextInput
autoCorrect
- onChangeText={setTitle}
+ accessibilityLabel="笔记标题"
+ onChangeText={(value) => {
+ setTitle(value);
+ markDirty();
+ }}
placeholder={DEFAULT_MEMO_TITLE}
placeholderTextColor="#94a3b8"
style={styles.createMemoTitleInput}
@@ -2191,8 +2391,12 @@ const CreateMemoModal = ({
<ChevronDown color="#64748b" size={14} />
</Pressable>
<TextInput
+ accessibilityLabel="笔记标签"
autoCorrect
- onChangeText={setTagsText}
+ onChangeText={(value) => {
+ setTagsText(value);
+ markDirty();
+ }}
placeholder="添加标签,用逗号分隔"
placeholderTextColor="#94a3b8"
style={styles.createMemoTagsInput}
@@ -2200,30 +2404,20 @@ const CreateMemoModal = ({
/>
</View>
- <View style={styles.createMemoToolbar}>
- <CreateMemoToolbarButton accessibilityLabel="从剪贴板插入图片链接" icon={<ImagePlus color="#64748b" size={18} />} onPress={() => void insertImageLinkFromClipboard()} />
- <CreateMemoToolbarButton accessibilityLabel="加粗" icon={<Bold color="#64748b" size={17} />} onPress={() => applyCreateEditorAction("bold")} />
- <CreateMemoToolbarButton accessibilityLabel="无序列表" icon={<List color="#64748b" size={18} />} onPress={() => applyCreateEditorAction("bullet")} />
- <CreateMemoToolbarButton accessibilityLabel="引用" icon={<Quote color="#64748b" size={17} />} onPress={() => applyCreateEditorAction("quote")} />
- <CreateMemoToolbarButton accessibilityLabel="分割线" icon={<Minus color="#64748b" size={18} />} onPress={() => applyCreateEditorAction("horizontalRule")} />
+ <View style={styles.createMemoEditorFrame}>
+ {!editorReady ? (
+ <View style={styles.richEditorLoading}>
+ <ActivityIndicator color="#0f172a" />
+ <Text style={styles.mutedText}>正在启动本地编辑器</Text>
+ </View>
+ ) : null}
+ {editorElement}
</View>
- <TextInput
- multiline
- onChangeText={setContentMarkdown}
- onSelectionChange={(event) => setContentSelection(event.nativeEvent.selection)}
- placeholder="开始记录..."
- placeholderTextColor="#94a3b8"
- selection={contentSelection}
- style={styles.createMemoContentInput}
- textAlignVertical="top"
- value={contentMarkdown}
- />
-
{createMutation.error ? (
<Text style={styles.errorText}>{createMutation.error instanceof Error ? createMutation.error.message : "创建失败"}</Text>
) : null}
- </ScrollView>
+ </View>
<NotebookPickerModal
activeNotebookId={targetNotebookId}
notebookSortMode="manual"
@@ -2233,6 +2427,7 @@ const CreateMemoModal = ({
onSelect={(nextNotebookId) => {
setNotebookId(nextNotebookId);
setNotebookPickerOpen(false);
+ markDirty();
}}
visible={notebookPickerOpen}
/>
@@ -4079,7 +4274,7 @@ const MemoDetailModal = ({
</View>
)}
{memo && !memo.isDeleted ? (
- <Pressable accessibilityLabel="编辑笔记" accessibilityRole="button" onPress={() => onEdit(memo)} style={styles.detailEditFab}>
+ <Pressable accessibilityLabel="编辑笔记" accessibilityRole="button" onPress={() => onRichEdit(memo)} style={styles.detailEditFab}>
<Pencil color="#ffffff" size={22} />
</Pressable>
) : null}
@@ -4094,7 +4289,7 @@ const MemoDetailModal = ({
) : (
<>
<ActionSheetItem disabled={isSaving} icon={<Pin color="#0f172a" size={18} />} label={memo.isPinned ? "取消置顶" : "置顶"} onPress={() => closeActionsAndRun(() => onTogglePin(memo))} />
- <ActionSheetItem icon={<Bold color="#0f172a" size={18} />} label="富文本编辑" onPress={() => closeActionsAndRun(() => onRichEdit(memo))} />
+ <ActionSheetItem icon={<Code color="#0f172a" size={18} />} label="Markdown 源代码编辑" onPress={() => closeActionsAndRun(() => onEdit(memo))} />
</>
)}
<ActionSheetItem icon={<Search color="#0f172a" size={18} />} label="查找当前笔记" onPress={() => closeActionsAndRun(() => setSearchOpen((open) => !open))} />
@@ -4148,108 +4343,345 @@ const HighlightedDetailText = ({
const RichEditorModal = ({
baseUrl,
+ imageCompressionEnabled,
memo,
notebooks,
onClose,
- token,
+ updateMutation,
}: {
baseUrl: string;
+ imageCompressionEnabled: boolean;
memo: MemoDetail | null;
notebooks: Notebook[];
onClose: () => void;
- token: string;
+ updateMutation: MobileMemoUpdateMutation;
}) => {
- const [loading, setLoading] = useState(true);
- const [error, setError] = useState(false);
- const editorUrl = memo && baseUrl ? buildRichEditorUrl(baseUrl, memo.id) : "";
- const injectedJavaScriptBeforeContentLoaded = buildRichEditorAuthScript(token);
- const notebookLabel = memo ? notebooks.find((notebook) => notebook.id === memo.notebookId)?.name ?? "未分类" : "笔记本";
- const saveLabel = error ? "加载失败" : loading ? "加载中" : "编辑中";
+ const { client } = useSession();
+ const editorRef = useRef<LocalTiptapEditorRef>(null);
+ const contentJsonRef = useRef<TiptapDoc>(memo?.contentJson ?? markdownToDoc(memo?.contentMarkdown ?? ""));
+ const contentMarkdownRef = useRef(memo?.contentMarkdown ?? "");
+ const contentSnapshotRef = useRef(JSON.stringify(contentJsonRef.current));
+ const dirtyRef = useRef(false);
+ const flushResolverRef = useRef<(() => void) | null>(null);
+ const savingRef = useRef(false);
+ const uploadingRef = useRef(false);
+ const [title, setTitle] = useState(memo?.title?.trim() || "");
+ const [tagsText, setTagsText] = useState(memo?.tags.join(", ") ?? "");
+ const [notebookId, setNotebookId] = useState(memo?.notebookId ?? "");
+ const [notebookPickerOpen, setNotebookPickerOpen] = useState(false);
+ const [draftLoaded, setDraftLoaded] = useState(false);
+ const [draftRestored, setDraftRestored] = useState(false);
+ const [ready, setReady] = useState(false);
+ const [dirty, setDirty] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const [uploading, setUploading] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const [startupMs, setStartupMs] = useState<number | null>(null);
+ const notebookLabel = notebooks.find((notebook) => notebook.id === notebookId)?.name ?? "未分类";
+ const saveLabel = error ? "保存失败" : saving ? "正在保存" : uploading ? "正在上传" : dirty ? "本地草稿" : ready ? "已保存" : "正在启动";
+ const titleRef = useRef(title);
+ const tagsTextRef = useRef(tagsText);
+ const notebookIdRef = useRef(notebookId);
+ titleRef.current = title;
+ tagsTextRef.current = tagsText;
+ notebookIdRef.current = notebookId;
useEffect(() => {
- if (memo) {
- setLoading(true);
- setError(false);
+ if (!memo) {
+ return;
}
- }, [memo]);
+ let active = true;
+ setDraftLoaded(false);
+ setDraftRestored(false);
+ setReady(false);
+ setSaving(false);
+ setUploading(false);
+ uploadingRef.current = false;
+ setError(null);
+ setStartupMs(null);
+
+ void readMobileMemoDraft(memo.id).then((draft) => {
+ if (!active) {
+ return;
+ }
+ const restoredDraft = draft?.expectedRevision === memo.revision ? draft : null;
+ const canRestore = restoredDraft !== null;
+ const restoredJson = restoredDraft ? markdownToDoc(restoredDraft.contentMarkdown) : memo.contentJson ?? markdownToDoc(memo.contentMarkdown || "");
+ contentJsonRef.current = restoredJson;
+ contentMarkdownRef.current = restoredDraft ? restoredDraft.contentMarkdown : memo.contentMarkdown || "";
+ contentSnapshotRef.current = JSON.stringify(restoredJson);
+ dirtyRef.current = canRestore;
+ setTitle(restoredDraft ? restoredDraft.title : memo.title?.trim() || "");
+ setTagsText(restoredDraft ? restoredDraft.tagsText : memo.tags.join(", "));
+ setNotebookId(restoredDraft ? restoredDraft.notebookId : memo.notebookId);
+ setDirty(canRestore);
+ setDraftRestored(canRestore);
+ setDraftLoaded(true);
+ });
+
+ return () => {
+ active = false;
+ };
+ }, [memo?.id]);
+
+ const persistDraft = async (contentJson: TiptapDoc) => {
+ if (!memo) {
+ return;
+ }
+ const contentSnapshot = JSON.stringify(contentJson);
+ if (contentSnapshot === contentSnapshotRef.current) {
+ flushResolverRef.current?.();
+ flushResolverRef.current = null;
+ return;
+ }
+ contentSnapshotRef.current = contentSnapshot;
+ contentJsonRef.current = contentJson;
+ contentMarkdownRef.current = docToMarkdown(contentJson);
+ dirtyRef.current = true;
+ setDirty(true);
+ setError(null);
+ flushResolverRef.current?.();
+ flushResolverRef.current = null;
+ await writeMobileMemoDraft({
+ memoId: memo.id,
+ expectedRevision: memo.revision,
+ title: titleRef.current.trim(),
+ contentMarkdown: contentMarkdownRef.current,
+ notebookId: notebookIdRef.current,
+ tagsText: tagsTextRef.current,
+ updatedAt: new Date().toISOString(),
+ });
+ };
+
+ const save = async () => {
+ if (!memo || savingRef.current || !notebookIdRef.current) {
+ return null;
+ }
+ if (!dirtyRef.current) {
+ return memo;
+ }
+ savingRef.current = true;
+ setSaving(true);
+ setError(null);
+
+ try {
+ const savedMemo = await updateMutation.mutateAsync({
+ memo,
+ payload: {
+ title: titleRef.current.trim() || DEFAULT_MEMO_TITLE,
+ contentJson: contentJsonRef.current,
+ contentMarkdown: contentMarkdownRef.current,
+ notebookId: notebookIdRef.current,
+ tags: parseTags(tagsTextRef.current),
+ },
+ });
+ await clearMobileMemoDraft(memo.id);
+ dirtyRef.current = false;
+ setDirty(false);
+ return savedMemo;
+ } catch (saveError) {
+ setError(saveError instanceof Error ? saveError.message : "保存失败");
+ return null;
+ } finally {
+ savingRef.current = false;
+ setSaving(false);
+ }
+ };
+
+ const flushEditor = async () => {
+ if (!editorRef.current) {
+ return;
+ }
+ await new Promise<void>((resolve) => {
+ let settled = false;
+ const finish = () => {
+ if (settled) {
+ return;
+ }
+ settled = true;
+ flushResolverRef.current = null;
+ resolve();
+ };
+ flushResolverRef.current = finish;
+ editorRef.current?.flush();
+ setTimeout(finish, 1000);
+ });
+ };
+
+ const requestClose = async () => {
+ if (savingRef.current || uploadingRef.current) {
+ return;
+ }
+ await flushEditor();
+ const savedMemo = await save();
+ if (savedMemo) {
+ onClose();
+ }
+ };
+
+ const pickAndUploadImage = async () => {
+ if (!client || !memo || uploadingRef.current) {
+ return null;
+ }
+ if (memo.id.startsWith("local:")) {
+ Alert.alert("正在同步新笔记", "首次同步完成后即可上传本地图片;图片链接现在就可以直接粘贴到正文。");
+ return null;
+ }
+ const DocumentPicker = await import("expo-document-picker");
+ const result = await DocumentPicker.getDocumentAsync({
+ copyToCacheDirectory: true,
+ multiple: false,
+ type: ["image/*"],
+ });
+ const asset = result.canceled ? null : result.assets[0];
+ if (!asset) {
+ return null;
+ }
+
+ uploadingRef.current = true;
+ setUploading(true);
+ setError(null);
+ try {
+ const uploadAsset = await prepareUploadAsset(asset, imageCompressionEnabled);
+ const form = new FormData();
+ form.append("file", uploadAsset as unknown as Blob);
+ const { resource } = await client.uploadMemoResource(memo.id, form);
+ return {
+ alt: resource.filename || uploadAsset.name || "图片",
+ url: resource.url,
+ };
+ } catch (uploadError) {
+ setError(uploadError instanceof Error ? uploadError.message : "图片上传失败");
+ return null;
+ } finally {
+ uploadingRef.current = false;
+ setUploading(false);
+ }
+ };
+
+ const editorElement = useMemo(
+ () => memo && baseUrl && draftLoaded ? (
+ <LocalTiptapEditor
+ baseUrl={baseUrl}
+ content={contentJsonRef.current}
+ dom={{
+ bounces: false,
+ contentInsetAdjustmentBehavior: "never",
+ overScrollMode: "never",
+ scrollEnabled: false,
+ style: styles.richEditorWebView,
+ }}
+ onChange={persistDraft}
+ onPickImage={pickAndUploadImage}
+ onReady={async (elapsedMs) => {
+ setStartupMs(elapsedMs);
+ setReady(true);
+ recordEditorStartup(elapsedMs);
+ }}
+ ref={editorRef}
+ />
+ ) : null,
+ [baseUrl, draftLoaded, memo?.id]
+ );
+
+ useEffect(() => {
+ if (!memo || !dirty) {
+ return;
+ }
+ const timeout = setTimeout(() => {
+ void writeMobileMemoDraft({
+ memoId: memo.id,
+ expectedRevision: memo.revision,
+ title: titleRef.current.trim(),
+ contentMarkdown: contentMarkdownRef.current,
+ notebookId: notebookIdRef.current,
+ tagsText: tagsTextRef.current,
+ updatedAt: new Date().toISOString(),
+ });
+ }, 350);
+ return () => clearTimeout(timeout);
+ }, [dirty, memo, notebookId, tagsText, title]);
return (
- <Modal animationType="slide" onRequestClose={onClose} presentationStyle="fullScreen" visible={Boolean(memo)}>
+ <Modal animationType="slide" onRequestClose={() => void requestClose()} presentationStyle="fullScreen" visible={Boolean(memo)}>
<SafeAreaView style={styles.richEditorSafeArea}>
<View style={styles.modalHeader}>
- <IconButton onPress={onClose}>
- <X color="#0f172a" size={20} />
+ <IconButton accessibilityLabel="保存并关闭" disabled={saving || uploading} onPress={() => void requestClose()}>
+ <X color={saving || uploading ? "#cbd5e1" : "#0f172a"} size={20} />
</IconButton>
<Text numberOfLines={1} style={styles.modalTitle}>
富文本编辑器
</Text>
- <IconButton onPress={() => editorUrl && Linking.openURL(editorUrl)}>
- <ExternalLink color="#0f172a" size={18} />
+ <IconButton accessibilityLabel="保存" disabled={saving || uploading || !ready} onPress={() => void flushEditor().then(save)}>
+ {saving ? <ActivityIndicator color="#0f172a" /> : <Check color={saving || uploading || !ready ? "#cbd5e1" : "#0f172a"} size={20} />}
</IconButton>
</View>
- {editorUrl ? (
+ {memo && baseUrl ? (
<View style={styles.richEditorContainer}>
<View style={styles.richEditorMeta}>
<View style={styles.richEditorTitleBlock}>
- <Text numberOfLines={1} style={styles.richEditorTitle}>
- {memo?.title?.trim() || DEFAULT_MEMO_TITLE}
- </Text>
- <Text numberOfLines={1} style={styles.richEditorNotebook}>
- {notebookLabel} · 修订 {memo?.revision ?? "-"}
- </Text>
+ <TextInput
+ onChangeText={(value) => {
+ setTitle(value);
+ dirtyRef.current = true;
+ setDirty(true);
+ }}
+ placeholder={DEFAULT_MEMO_TITLE}
+ placeholderTextColor="#94a3b8"
+ style={styles.richEditorTitle}
+ value={title}
+ />
+ <Pressable accessibilityRole="button" onPress={() => setNotebookPickerOpen(true)}>
+ <Text numberOfLines={1} style={styles.richEditorNotebook}>{notebookLabel} · 修订 {memo.revision}</Text>
+ </Pressable>
</View>
- <Text style={[styles.richEditorStatus, error ? styles.richEditorStatusError : loading ? styles.richEditorStatusLoading : styles.richEditorStatusActive]}>{saveLabel}</Text>
+ <Text style={[styles.richEditorStatus, error ? styles.richEditorStatusError : saving || uploading || !ready ? styles.richEditorStatusLoading : styles.richEditorStatusActive]}>{saveLabel}</Text>
</View>
- {memo?.tags.length ? (
- <ScrollView contentContainerStyle={styles.richEditorTagsContent} horizontal showsHorizontalScrollIndicator={false} style={styles.richEditorTags}>
- {memo.tags.map((tag) => (
- <Text key={tag} style={styles.tag}>
- #{tag}
- </Text>
- ))}
- </ScrollView>
- ) : null}
+ <TextInput
+ autoCapitalize="none"
+ onChangeText={(value) => {
+ setTagsText(value);
+ dirtyRef.current = true;
+ setDirty(true);
+ }}
+ placeholder="标签,用逗号分隔"
+ placeholderTextColor="#94a3b8"
+ style={styles.richEditorTagsInput}
+ value={tagsText}
+ />
+ {draftRestored ? <Text style={styles.richEditorDraftNotice}>已恢复上次未完成的本地草稿</Text> : null}
<View style={styles.richEditorFrame}>
- {loading ? (
+ {!ready || !draftLoaded ? (
<View style={styles.richEditorLoading}>
<ActivityIndicator color="#0f172a" />
- <Text style={styles.mutedText}>正在加载 TipTap 编辑器</Text>
+ <Text style={styles.mutedText}>正在启动本地编辑器</Text>
</View>
) : null}
- {error ? (
- <View style={styles.centerState}>
- <Text style={styles.errorText}>富文本编辑器加载失败</Text>
- <Text style={styles.mutedText}>请确认实例已部署最新版 Web/PWA 资源。</Text>
- </View>
- ) : (
- <Suspense fallback={<ActivityIndicator color="#0f172a" />}>
- <LazyWebView
- allowsBackForwardNavigationGestures
- injectedJavaScriptBeforeContentLoaded={injectedJavaScriptBeforeContentLoaded}
- onError={() => {
- setLoading(false);
- setError(true);
- }}
- onLoadEnd={() => setLoading(false)}
- onNavigationStateChange={(state) => {
- if (state.url && !state.url.includes("/mobile-edit.html") && !state.url.startsWith("about:")) {
- onClose();
- }
- }}
- originWhitelist={["http://*", "https://*"]}
- source={{ uri: editorUrl }}
- style={styles.richEditorWebView}
- />
- </Suspense>
- )}
+ {editorElement}
</View>
+ {error ? <Text style={styles.richEditorInlineError}>{error}</Text> : null}
+ {startupMs !== null && __DEV__ ? <Text style={styles.richEditorPerf}>本地编辑器启动:{startupMs}ms</Text> : null}
</View>
) : (
<View style={styles.centerState}>
- <Text style={styles.errorText}>缺少实例地址,无法打开富文本编辑器</Text>
+ <Text style={styles.errorText}>缺少笔记数据,无法打开富文本编辑器</Text>
</View>
)}
+ <NotebookPickerModal
+ activeNotebookId={notebookId}
+ notebookSortMode="manual"
+ notebooks={notebooks}
+ notebooksMemoCount={notebooks.reduce((total, notebook) => total + notebook.memoCount, 0)}
+ onClose={() => setNotebookPickerOpen(false)}
+ onSelect={(nextNotebookId) => {
+ setNotebookId(nextNotebookId);
+ setNotebookPickerOpen(false);
+ dirtyRef.current = true;
+ setDirty(true);
+ }}
+ visible={notebookPickerOpen}
+ />
</SafeAreaView>
</Modal>
);
@@ -4268,20 +4700,7 @@ const EditMemoModal = ({
notebooks: Notebook[];
onClose: () => void;
onSaved: (memo: MemoDetail) => void;
- updateMutation: UseMutationResult<
- MemoDetail,
- Error,
- {
- memo: MemoDetail;
- payload: {
- title?: string;
- contentMarkdown?: string;
- isPinned?: boolean;
- notebookId?: string;
- tags?: string[];
- };
- }
- >;
+ updateMutation: MobileMemoUpdateMutation;
}) => {
const { client } = useSession();
const [title, setTitle] = useState("");
@@ -4653,12 +5072,15 @@ const MemoList = ({
error,
isError,
isLoading,
+ isLoadingMore = false,
isRefreshing,
listDensity,
memos,
onMemoLongPress,
onMemoPress,
+ onLoadMore,
onRefresh,
+ onRetry,
selectionMode = false,
selectedMemoIds = new Set(),
}: {
@@ -4668,12 +5090,15 @@ const MemoList = ({
error?: unknown;
isError: boolean;
isLoading: boolean;
+ isLoadingMore?: boolean;
isRefreshing: boolean;
listDensity: MobileMemoListDensity;
memos: MemoSummary[];
onMemoLongPress?: (memo: MemoSummary) => void;
onMemoPress: (memoId: string) => void;
+ onLoadMore?: () => void;
onRefresh: () => void;
+ onRetry?: () => void;
selectionMode?: boolean;
selectedMemoIds?: Set<string>;
}) => {
@@ -4690,6 +5115,12 @@ const MemoList = ({
<View style={styles.centerState}>
<Text style={styles.errorText}>加载失败</Text>
<Text style={styles.mutedText}>{error instanceof Error ? error.message : "请稍后再试"}</Text>
+ {onRetry ? (
+ <Pressable accessibilityLabel="重试加载" accessibilityRole="button" onPress={onRetry} style={styles.emptyActionButton}>
+ <RotateCcw color="#ffffff" size={17} />
+ <Text style={styles.emptyActionButtonText}>重试</Text>
+ </Pressable>
+ ) : null}
</View>
);
}
@@ -4701,6 +5132,8 @@ const MemoList = ({
initialNumToRender={10}
keyExtractor={(memo) => memo.id}
maxToRenderPerBatch={8}
+ onEndReached={onLoadMore}
+ onEndReachedThreshold={0.35}
removeClippedSubviews={Platform.OS === "android"}
refreshControl={<RefreshControl onRefresh={onRefresh} refreshing={isRefreshing} tintColor="#0f172a" />}
renderItem={({ item }) => (
@@ -4726,6 +5159,7 @@ const MemoList = ({
) : null}
</View>
}
+ ListFooterComponent={isLoadingMore ? <ActivityIndicator color="#0f172a" style={styles.listLoadingFooter} /> : null}
updateCellsBatchingPeriod={32}
windowSize={7}
/>
@@ -5069,7 +5503,7 @@ const MemoCard = memo(function MemoCard({
</Text>
) : null}
<View style={[styles.memoMeta, listDensity === "compact" && styles.memoMetaCompact]}>
- <Text style={styles.memoDate}>{formatDate(memo.updatedAt, localePreference)}</Text>
+ <Text style={styles.memoDate}>{formatMemoPreviewDate(memo.updatedAt, localePreference)}</Text>
{memo.tags.slice(0, 2).map((tag) => (
<Text key={tag} style={styles.tag}>
#{tag}
@@ -5597,6 +6031,24 @@ const formatDate = (value: string, localePreference: MobileLocaleMode = "system"
minute: "2-digit",
}).format(new Date(value));
+const formatMemoPreviewDate = (value: string, localePreference: MobileLocaleMode = "system") => {
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) {
+ return "";
+ }
+ const now = new Date();
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
+ const memoDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
+ const locale = getResolvedMobileLocale(localePreference);
+ if (memoDay === today) {
+ return new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit" }).format(date);
+ }
+ if (memoDay === today - 24 * 60 * 60 * 1000) {
+ return isEnglishMobileLocale(localePreference) ? "Yesterday" : "昨天";
+ }
+ return new Intl.DateTimeFormat(locale, { year: "numeric", month: "numeric", day: "numeric" }).format(date);
+};
+
const formatBytes = (bytes: number) => {
if (!Number.isFinite(bytes) || bytes <= 0) {
return "0 B";
@@ -5708,13 +6160,7 @@ const prepareUploadAsset = async (
const createOptimisticMemo = (
memo: MemoDetail,
- payload: {
- title?: string;
- contentMarkdown?: string;
- isPinned?: boolean;
- notebookId?: string;
- tags?: string[];
- }
+ payload: MobileMemoUpdatePayload
): MemoDetail => {
const contentMarkdown = payload.contentMarkdown ?? memo.contentMarkdown;
const contentText = markdownToLocalText(contentMarkdown);
@@ -5725,6 +6171,7 @@ const createOptimisticMemo = (
...(payload.isPinned !== undefined ? { isPinned: payload.isPinned } : {}),
...(payload.notebookId !== undefined ? { notebookId: payload.notebookId } : {}),
...(payload.tags !== undefined ? { tags: payload.tags } : {}),
+ ...(payload.contentJson !== undefined ? { contentJson: payload.contentJson } : {}),
...(payload.contentMarkdown !== undefined
? {
contentMarkdown,
@@ -5749,27 +6196,38 @@ const applyOptimisticMemoToCache = (queryClient: QueryClient, previousMemo: Memo
const listQueries = queryClient.getQueryCache().findAll({ queryKey: ["mobile", "memos"] });
for (const query of listQueries) {
- const data = query.state.data as { memos?: MemoSummary[]; totalCount?: number; nextCursor?: string | null } | undefined;
- if (!data?.memos) {
+ const data = query.state.data as InfiniteData<Awaited<ReturnType<typeof listLocalMemos>>, number> | undefined;
+ if (!Array.isArray(data?.pages) || data.pages.length === 0) {
continue;
}
const previouslyMatched = memoMatchesListQuery(previousMemo, query.queryKey);
const nextMatches = memoMatchesListQuery(nextMemo, query.queryKey);
- const withoutMemo = data.memos.filter((memo) => memo.id !== nextMemo.id && memo.id !== previousMemo.id);
- const memos = nextMatches ? sortMemoSummaries([nextMemo, ...withoutMemo], query.queryKey[5]).slice(0, 50) : withoutMemo;
- const totalCount = Math.max(0, (data.totalCount ?? data.memos.length) + (nextMatches ? 1 : 0) - (previouslyMatched ? 1 : 0));
+ const flattened = data.pages.flatMap((page) => page.memos);
+ const withoutMemo = flattened.filter((memo) => memo.id !== nextMemo.id && memo.id !== previousMemo.id);
+ const nextMemos = nextMatches ? sortMemoSummaries([nextMemo, ...withoutMemo], query.queryKey[5]) : withoutMemo;
+ const totalCount = Math.max(0, data.pages[0].totalCount + (nextMatches ? 1 : 0) - (previouslyMatched ? 1 : 0));
+ let cursor = 0;
+ const pages = data.pages.map((page, index) => {
+ const pageSize = index === data.pages.length - 1 ? Math.min(page.memos.length, Math.max(0, nextMemos.length - cursor)) : page.memos.length;
+ const memos = nextMemos.slice(cursor, cursor + pageSize);
+ cursor += pageSize;
+ return { ...page, memos, totalCount };
+ });
- queryClient.setQueryData(query.queryKey, { ...data, memos, totalCount });
+ queryClient.setQueryData(query.queryKey, { ...data, pages });
}
const searchQueries = queryClient.getQueryCache().findAll({ queryKey: ["mobile", "search"] });
for (const query of searchQueries) {
- const data = query.state.data as { memos?: MemoSummary[] } | undefined;
- if (data?.memos?.some((memo) => memo.id === nextMemo.id || memo.id === previousMemo.id)) {
+ const data = query.state.data as InfiniteData<Awaited<ReturnType<typeof listLocalMemos>>, number> | undefined;
+ if (Array.isArray(data?.pages) && data.pages.some((page) => page.memos.some((memo) => memo.id === nextMemo.id || memo.id === previousMemo.id))) {
queryClient.setQueryData(query.queryKey, {
...data,
- memos: data.memos.map((memo) => (memo.id === nextMemo.id || memo.id === previousMemo.id ? nextMemo : memo)),
+ pages: data.pages.map((page) => ({
+ ...page,
+ memos: page.memos.map((memo) => (memo.id === nextMemo.id || memo.id === previousMemo.id ? nextMemo : memo)),
+ })),
});
}
}
@@ -5988,57 +6446,6 @@ const formatRevisionActor = (actor: string) => {
return actor || "system";
};
-const buildRichEditorUrl = (baseUrl: string, memoId: string) => {
- const normalizedBaseUrl = baseUrl.replace(/\/+$/, "");
- const params = new URLSearchParams({
- memoId,
- returnTo: "/",
- });
-
- return `${normalizedBaseUrl}/mobile-edit.html#${params.toString()}`;
-};
-
-const buildRichEditorAuthScript = (token: string) => `
-(() => {
- const token = ${JSON.stringify(token)};
- if (!token) {
- return true;
- }
-
- const applyAuthHeader = (headers) => {
- const nextHeaders = new Headers(headers || {});
- if (!nextHeaders.has("Authorization")) {
- nextHeaders.set("Authorization", "Bearer " + token);
- }
- return nextHeaders;
- };
-
- const shouldAuthorize = (input) => {
- const url = typeof input === "string" ? input : input && "url" in input ? input.url : "";
- if (!url) {
- return true;
- }
- return url.startsWith("/api/") || url.includes("/api/");
- };
-
- const originalFetch = window.fetch.bind(window);
- window.fetch = (input, init = {}) => {
- if (!shouldAuthorize(input)) {
- return originalFetch(input, init);
- }
-
- if (input instanceof Request) {
- const headers = applyAuthHeader(init.headers || input.headers);
- return originalFetch(new Request(input, { ...init, headers }));
- }
-
- return originalFetch(input, { ...init, headers: applyAuthHeader(init.headers) });
- };
-
- true;
-})();
-`;
-
const getSyncQueueStatusLabel = (status: MobileSyncQueueItem["status"]) => {
const labels: Record<MobileSyncQueueItem["status"], string> = {
pending: "待同步",
@@ -6580,6 +6987,9 @@ const styles = StyleSheet.create({
paddingHorizontal: 12,
paddingTop: 12,
},
+ listLoadingFooter: {
+ marginVertical: 18,
+ },
assetList: {
padding: 18,
paddingBottom: 48,
@@ -6952,11 +7362,20 @@ const styles = StyleSheet.create({
flex: 1,
},
createMemoMain: {
- flexGrow: 1,
- paddingBottom: 32,
+ flex: 1,
+ paddingBottom: 8,
paddingHorizontal: 12,
paddingTop: 14,
},
+ createMemoDraftNotice: {
+ backgroundColor: "#fffbeb",
+ borderRadius: 8,
+ color: "#92400e",
+ fontSize: 12,
+ marginBottom: 8,
+ paddingHorizontal: 10,
+ paddingVertical: 7,
+ },
createMemoTitleInput: {
color: "#0f172a",
fontSize: 28,
@@ -7030,6 +7449,19 @@ const styles = StyleSheet.create({
paddingHorizontal: 0,
paddingTop: 18,
},
+ createMemoEditorFrame: {
+ borderColor: "#e2e8f0",
+ borderRadius: 10,
+ borderWidth: 1,
+ flex: 1,
+ marginHorizontal: -4,
+ marginTop: 4,
+ overflow: "hidden",
+ },
+ createMemoEditor: {
+ backgroundColor: "#ffffff",
+ flex: 1,
+ },
richEditorSafeArea: {
backgroundColor: "#ffffff",
flex: 1,
@@ -7095,6 +7527,16 @@ const styles = StyleSheet.create({
paddingHorizontal: 14,
paddingVertical: 9,
},
+ richEditorTagsInput: {
+ backgroundColor: "#ffffff",
+ borderBottomColor: "#e2e8f0",
+ borderBottomWidth: 1,
+ color: "#64748b",
+ fontSize: 14,
+ minHeight: 40,
+ paddingHorizontal: 14,
+ paddingVertical: 8,
+ },
richEditorFrame: {
flex: 1,
},
@@ -7114,6 +7556,28 @@ const styles = StyleSheet.create({
backgroundColor: "#ffffff",
flex: 1,
},
+ richEditorInlineError: {
+ backgroundColor: "#fef2f2",
+ color: "#b91c1c",
+ fontSize: 12,
+ paddingHorizontal: 14,
+ paddingVertical: 8,
+ },
+ richEditorDraftNotice: {
+ backgroundColor: "#fffbeb",
+ color: "#92400e",
+ fontSize: 12,
+ paddingHorizontal: 14,
+ paddingVertical: 7,
+ },
+ richEditorPerf: {
+ backgroundColor: "#f8fafc",
+ color: "#64748b",
+ fontSize: 10,
+ paddingHorizontal: 14,
+ paddingVertical: 4,
+ textAlign: "right",
+ },
modalHeader: {
alignItems: "center",
borderBottomColor: "#e2e8f0",
diff --git a/bun.lock b/bun.lock
index 7d027b6f..da7fb562 100644
--- a/bun.lock
+++ b/bun.lock
@@ -79,7 +79,7 @@
},
"apps/mobile": {
"name": "@edgeever/mobile",
- "version": "0.4.0",
+ "version": "0.4.4",
"dependencies": {
"@edgeever/client": "workspace:*",
"@edgeever/shared": "workspace:*",
@@ -89,6 +89,10 @@
"@tanstack/query-async-storage-persister": "^5.101.2",
"@tanstack/react-query": "latest",
"@tanstack/react-query-persist-client": "^5.101.2",
+ "@tiptap/extension-image": "3.27.1",
+ "@tiptap/extension-placeholder": "3.27.1",
+ "@tiptap/react": "3.27.1",
+ "@tiptap/starter-kit": "3.27.1",
"expo": "~57.0.7",
"expo-build-properties": "~57.0.6",
"expo-clipboard": "~57.0.1",
@@ -101,6 +105,7 @@
"expo-sqlite": "~57.0.1",
"expo-status-bar": "latest",
"react": "19.2.3",
+ "react-dom": "19.2.3",
"react-native": "latest",
"react-native-gesture-handler": "~2.32.0",
"react-native-markdown-display": "^7.0.2",
@@ -108,7 +113,7 @@
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-svg": "15.15.4",
- "react-native-webview": "13.16.1",
+ "react-native-web": "~0.21.0",
},
"devDependencies": {
"@types/react": "latest",
@@ -1422,6 +1427,8 @@
"core-js-compat": ["[email protected]", "", { "dependencies": { "browserslist": "^4.28.1" } }, "sha512-VQXt1jr9cBz03b331DFDCCP90b3fanciLkgiOoy8SBHy06gNf+vQ1A3WFLqG7I8TipYIKeYK9wxd0tUrvHcOZA=="],
+ "cross-fetch": ["[email protected]", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q=="],
+
"cross-spawn": ["[email protected]", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"crossws": ["[email protected]", "", { "dependencies": { "uncrypto": "^0.1.3" } }, "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA=="],
@@ -1430,6 +1437,8 @@
"css-color-keywords": ["[email protected]", "", {}, "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg=="],
+ "css-in-js-utils": ["[email protected]", "", { "dependencies": { "hyphenate-style-name": "^1.0.3" } }, "sha512-fJAcud6B3rRu+KHYk+Bwf+WFL2MDCJJ1XG9x137tJQ0xYxor7XziQtuGFbWNdqrvF4Tk26O3H73nfVqXt/fW1A=="],
+
"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-to-react-native": ["[email protected]", "", { "dependencies": { "camelize": "^1.0.0", "css-color-keywords": "^1.0.0", "postcss-value-parser": "^4.0.2" } }, "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ=="],
@@ -1664,6 +1673,10 @@
"fb-watchman": ["[email protected]", "", { "dependencies": { "bser": "2.1.1" } }, "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA=="],
+ "fbjs": ["[email protected]", "", { "dependencies": { "cross-fetch": "^3.1.5", "fbjs-css-vars": "^1.0.0", "loose-envify": "^1.0.0", "object-assign": "^4.1.0", "promise": "^7.1.1", "setimmediate": "^1.0.5", "ua-parser-js": "^1.0.35" } }, "sha512-ztsSx77JBtkuMrEypfhgc3cI0+0h+svqeie7xHbh1k/IKdcydnvadp/mUaGgjAOXQmQSxsqgaRhS3q9fy+1kxg=="],
+
+ "fbjs-css-vars": ["[email protected]", "", {}, "sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ=="],
+
"fd-slicer": ["[email protected]", "", { "dependencies": { "pend": "~1.2.0" } }, "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g=="],
"fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
@@ -1828,6 +1841,8 @@
"https-proxy-agent": ["[email protected]", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="],
+ "hyphenate-style-name": ["[email protected]", "", {}, "sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw=="],
+
"i18next": ["[email protected]", "", { "peerDependencies": { "typescript": "^5 || ^6" }, "optionalPeers": ["typescript"] }, "sha512-pa7m0d7pBDqGHZxljT+WPFeyFgQ7P7SciPPo1tTqYuO0z4sqADYhwnBESmmGp/wEof1inwdls/k8ZgTg8rxFHA=="],
"iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
@@ -1848,6 +1863,8 @@
"inline-style-parser": ["[email protected]", "", {}, "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA=="],
+ "inline-style-prefixer": ["[email protected]", "", { "dependencies": { "css-in-js-utils": "^3.1.0" } }, "sha512-lhYo5qNTQp3EvSSp3sRvXMbVQTLrvGV6DycRMJ5dm2BLMiJ30wpXKdDdgX+GmJZ5uQMucwRKHamXSst3Sj/Giw=="],
+
"internal-slot": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw=="],
"invariant": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.0.0" } }, "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA=="],
@@ -2264,6 +2281,8 @@
"nlcst-to-string": ["[email protected]", "", { "dependencies": { "@types/nlcst": "^2.0.0" } }, "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA=="],
+ "node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
+
"node-fetch-native": ["[email protected]", "", {}, "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q=="],
"node-forge": ["[email protected]", "", {}, "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ=="],
@@ -2500,6 +2519,8 @@
"react-native-svg": ["[email protected]", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-boT/vIRgj6zZKBpfTPJJiYWMbZE9duBMOwPK6kCSTgxsS947IFMOq9OgIFkpWZTB7t229H24pDRkh3W9ZK/J1A=="],
+ "react-native-web": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.6", "@react-native/normalize-colors": "^0.74.1", "fbjs": "^3.0.4", "inline-style-prefixer": "^7.0.1", "memoize-one": "^6.0.0", "nullthrows": "^1.1.1", "postcss-value-parser": "^4.2.0", "styleq": "^0.1.3" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-SO2t9/17zM4iEnFvlu2DA9jqNbzNhoUP+AItkoCOyFmDMOhUnBBznBDCYN92fGdfAkfQlWzPoez6+zLxFNsZEg=="],
+
"react-native-webview": ["[email protected]", "", { "dependencies": { "escape-string-regexp": "^4.0.0", "invariant": "2.2.4" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-If0eHhoEdOYDcHsX+xBFwHMbWBGK1BvGDQDQdVkwtSIXiq1uiqjkpWVP2uQ1as94J0CzvFE9PUNDuhiX0Z6ubw=="],
"react-native-worklets": ["[email protected]", "", { "dependencies": { "@babel/plugin-transform-arrow-functions": "^7.27.1", "@babel/plugin-transform-class-properties": "^7.28.6", "@babel/plugin-transform-classes": "^7.28.6", "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6", "@babel/plugin-transform-optional-chaining": "^7.28.6", "@babel/plugin-transform-shorthand-properties": "^7.27.1", "@babel/plugin-transform-template-literals": "^7.27.1", "@babel/plugin-transform-unicode-regex": "^7.27.1", "@babel/preset-typescript": "^7.28.5", "@babel/types": "^7.27.1", "convert-source-map": "^2.0.0", "semver": "^7.7.4" }, "peerDependencies": { "@babel/core": "*", "@react-native/metro-config": "*", "react": "*", "react-native": "0.83 - 0.86" } }, "sha512-LX27ejYI8veeDp59Z3rjo2pYyPa9euzSH8GUlem7cnNqfsDtGum8PQpkbzrqhLsWH0CjdeHR7p3sncCyYbwaVw=="],
@@ -2642,6 +2663,8 @@
"set-proto": ["[email protected]", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0" } }, "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw=="],
+ "setimmediate": ["[email protected]", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="],
+
"setprototypeof": ["[email protected]", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
"sf-symbols-typescript": ["[email protected]", "", {}, "sha512-TPbeg0b7ylrswdGCji8FRGFAKuqbpQlLbL8SOle3j1iHSs5Ob5mhvMAxWN2UItOjgALAB5Zp3fmMfj8mbWvXKw=="],
@@ -2742,6 +2765,8 @@
"style-to-object": ["[email protected]", "", { "dependencies": { "inline-style-parser": "0.2.7" } }, "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw=="],
+ "styleq": ["[email protected]", "", {}, "sha512-3ZUifmCDCQanjeej1f6kyl/BeP/Vae5EYkQ9iJfUm/QwZvlgnZzyflqAsAWYURdtea8Vkvswu2GrC57h3qffcA=="],
+
"sucrase": ["[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw=="],
"supports-color": ["[email protected]", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
@@ -2826,6 +2851,8 @@
"typescript-auto-import-cache": ["[email protected]", "", { "dependencies": { "semver": "^7.3.8" } }, "sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ=="],
+ "ua-parser-js": ["[email protected]", "", { "bin": { "ua-parser-js": "script/cli.js" } }, "sha512-LbBDqdIC5s8iROCUjMbW1f5dJQTEFB1+KO9ogbvlb3nm9n4YHa5p4KTvFPWvh2Hs8gZMBuiB1/8+pdfe/tDPug=="],
+
"uc.micro": ["[email protected]", "", {}, "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="],
"ufo": ["[email protected]", "", {}, "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA=="],
@@ -3114,6 +3141,8 @@
"@edgeever/mobile/react": ["[email protected]", "", {}, "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA=="],
+ "@edgeever/mobile/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.3" } }, "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg=="],
+
"@edgeever/site/sharp": ["[email protected]", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="],
"@edgeever/site/tailwindcss": ["[email protected]", "", {}, "sha512-WtctNNSH8A9jlMIqxzuYumOHU5uGZyRv0Q5svQl+oEPy5w84YpBxdb7MdqyiSPQge5jTJ6zFQLq0PFygdccSBA=="],
@@ -3278,6 +3307,8 @@
"fast-glob/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
+ "fbjs/promise": ["[email protected]", "", { "dependencies": { "asap": "~2.0.3" } }, "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg=="],
+
"filelist/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],
"finalhandler/debug": ["[email protected]", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
@@ -3352,6 +3383,8 @@
"mlly/pkg-types": ["[email protected]", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="],
+ "node-fetch/whatwg-url": ["[email protected]", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
+
"open/is-docker": ["[email protected]", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="],
"open/is-wsl": ["[email protected]", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
@@ -3382,6 +3415,10 @@
"react-native-css-interop/lightningcss": ["[email protected]", "", { "dependencies": { "detect-libc": "^1.0.3" }, "optionalDependencies": { "lightningcss-darwin-arm64": "1.27.0", "lightningcss-darwin-x64": "1.27.0", "lightningcss-freebsd-x64": "1.27.0", "lightningcss-linux-arm-gnueabihf": "1.27.0", "lightningcss-linux-arm64-gnu": "1.27.0", "lightningcss-linux-arm64-musl": "1.27.0", "lightningcss-linux-x64-gnu": "1.27.0", "lightningcss-linux-x64-musl": "1.27.0", "lightningcss-win32-arm64-msvc": "1.27.0", "lightningcss-win32-x64-msvc": "1.27.0" } }, "sha512-8f7aNmS1+etYSLHht0fQApPc2kNO8qGRutifN5rVIc6Xo6ABsEbqOr758UwI7ALVbTt4x1fllKt0PYgzD9S3yQ=="],
+ "react-native-web/@react-native/normalize-colors": ["@react-native/[email protected]", "", {}, "sha512-qoMMXddVKVhZ8PA1AbUCk83trpd6N+1nF2A6k1i6LsQObyS92fELuk8kU/lQs6M7BsMHwqyLCpQJ1uFgNvIQXg=="],
+
+ "react-native-web/memoize-one": ["[email protected]", "", {}, "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="],
+
"readdirp/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
"recast/source-map": ["[email protected]", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
@@ -3734,6 +3771,10 @@
"mlly/pkg-types/confbox": ["[email protected]", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="],
+ "node-fetch/whatwg-url/tr46": ["[email protected]", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
+
+ "node-fetch/whatwg-url/webidl-conversions": ["[email protected]", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
+
"ora/chalk/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],
"ora/chalk/escape-string-regexp": ["[email protected]", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="],