Skip to content

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

Extract mobile editor navigation helper

yoma158ef57f8e68
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index a7090dd2..06857095 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -50,6 +50,7 @@ import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "@
import { EditorToolbar } from "./EditorToolbar";
import { RevisionHistoryDialog } from "./dialogs/RevisionHistoryDialog";
import { api } from "@/lib/api";
+import { openStandaloneMobileEditor } from "@/lib/mobile-editor";
import { cn, formatDateTime, parseTagsText } from "@/lib/utils";
import { docToMarkdown, markdownToDoc, type Notebook, type MemoDetail, type TiptapDoc } from "@edgeever/shared";
import { compressImageForUpload } from "@/lib/image-compression";
@@ -467,14 +468,6 @@ type RichEditorPaneProps = EditorPaneProps & {
onRequestMobileNativeEdit?: () => void;
};
-const openStandaloneMobileEditor = (memoId: string) => {
- const params = new URLSearchParams({
- memoId,
- returnTo: "/",
- });
- window.location.href = `/mobile-edit.html#${params.toString()}`;
-};
-
const MobileNativeEditorPane = ({
memo,
notebooks,
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index b241162f..28b3bc8b 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -27,6 +27,7 @@ import {
import { MemoListPane, MemoSelectionActionBar } from "./MemoListPane";
import { AppConfirmDialog, MemoDeleteConfirmDialog, NotebookNameDialog } from "./dialogs/ConfirmDialogs";
import { api } from "@/lib/api";
+import { openStandaloneMobileEditor } from "@/lib/mobile-editor";
import { cn } from "@/lib/utils";
import { createExcerpt, docToText, type Notebook, type AuthUser, type MemoSummary, type MemoDetail } from "@edgeever/shared";
import type {
@@ -79,14 +80,6 @@ const isStandaloneApp = () =>
window.matchMedia("(display-mode: fullscreen)").matches ||
Boolean((navigator as Navigator & { standalone?: boolean }).standalone);
-const openStandaloneMobileEditor = (memoId: string) => {
- const params = new URLSearchParams({
- memoId,
- returnTo: "/",
- });
- window.location.href = `/mobile-edit.html#${params.toString()}`;
-};
-
const getVerticalScrollContainer = (target: EventTarget | null) => {
let element = target instanceof HTMLElement ? target : null;
diff --git a/apps/web/src/lib/mobile-editor.ts b/apps/web/src/lib/mobile-editor.ts
new file mode 100644
index 00000000..37ff08e2
--- /dev/null
+++ b/apps/web/src/lib/mobile-editor.ts
@@ -0,0 +1,7 @@
+export const openStandaloneMobileEditor = (memoId: string) => {
+ const params = new URLSearchParams({
+ memoId,
+ returnTo: "/",
+ });
+ window.location.href = `/mobile-edit.html#${params.toString()}`;
+};