Skip to content

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

Use in-app mobile editor navigation

yoma9cbd9ff10794
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index a7090dd2..9531a06d 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -467,14 +467,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,
@@ -953,12 +945,6 @@ export const EditorPane = (props: EditorPaneProps) => {
(mobileDefaultEditRequested || mobileNativeEditMemoId === props.memo.id)
);
- useEffect(() => {
- if (isMobileViewport && mobileDefaultEditRequested && props.memo?.id) {
- openStandaloneMobileEditor(props.memo.id);
- }
- }, [isMobileViewport, mobileDefaultEditRequested, props.memo?.id]);
-
useEffect(() => {
const mediaQuery = window.matchMedia(MOBILE_EDITOR_QUERY);
const updateMobileViewport = () => setIsMobileViewport(mediaQuery.matches);
@@ -975,9 +961,10 @@ export const EditorPane = (props: EditorPaneProps) => {
if (mobileNativeEditingActive) {
return (
- <div className="flex h-full min-h-0 items-center justify-center bg-white text-sm font-medium text-slate-400">
- 打开编辑器
- </div>
+ <MobileNativeEditorPane
+ {...props}
+ onExitMobileNativeEdit={() => setMobileNativeEditMemoId(null)}
+ />
);
}
@@ -988,7 +975,6 @@ export const EditorPane = (props: EditorPaneProps) => {
onRequestMobileNativeEdit={() => {
if (props.memo?.id && !readOnly) {
setMobileNativeEditMemoId(props.memo.id);
- openStandaloneMobileEditor(props.memo.id);
}
}}
/>
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 0db23ffa..3bbfab57 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -79,14 +79,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;
@@ -1263,9 +1255,6 @@ export const WorkspaceApp = ({
setSelectedMemoId(data.memo.id);
setActivePane("editor");
- if (!isDesktopViewport()) {
- openStandaloneMobileEditor(data.memo.id);
- }
},
});
diff --git a/apps/web/src/mobile-edit.tsx b/apps/web/src/mobile-edit.tsx
index 6dc99bd1..f945f9a1 100644
--- a/apps/web/src/mobile-edit.tsx
+++ b/apps/web/src/mobile-edit.tsx
@@ -333,16 +333,7 @@ const MobileTiptapEditorApp = () => {
}, [persistLocalDraft, saveNow, setSaveStateStable]);
const navigateBack = useCallback(() => {
- const referrerUrl = document.referrer ? new URL(document.referrer) : null;
- const canRestorePreviousPage = Boolean(referrerUrl && referrerUrl.origin === window.location.origin && window.history.length > 1);
-
- if (!canRestorePreviousPage) {
- window.location.replace(returnTo);
- return;
- }
-
- const currentState = window.history.state as { edgeeverMobileEditorBackGuard?: boolean } | null;
- window.history.go(currentState?.edgeeverMobileEditorBackGuard ? -2 : -1);
+ window.location.replace(returnTo);
}, [returnTo]);
const leavePage = useCallback(async () => {