Skip to content

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

fix: render mobile notes from complete content

tianma-if40e7480301b8
diff --git a/apps/mobile/src/screens/WorkspaceMemoDetail.tsx b/apps/mobile/src/screens/WorkspaceMemoDetail.tsx
index 459221f6..9d0b2a3a 100644
--- a/apps/mobile/src/screens/WorkspaceMemoDetail.tsx
+++ b/apps/mobile/src/screens/WorkspaceMemoDetail.tsx
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import type { MemoDetail } from "@edgeever/shared";
+import { resolveMemoContentMarkdown, type MemoDetail } from "@edgeever/shared";
import { ActivityIndicator, Image as RNImage, Platform, ScrollView, StyleSheet, Text as RNText, useWindowDimensions, View, type ImageStyle, type StyleProp, type ViewStyle } from "react-native";
import { Modal } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
@@ -321,7 +321,9 @@ export const MemoDetailModal = ({
th: (node, children, parents, markdownStyles) => renderTableCell(node, children, parents, markdownStyles, true),
};
}, [resolvedLocale, resolvedTheme, session, viewportWidth]);
- const detailText = memo?.contentMarkdown || memo?.contentText || "没有正文内容";
+ const detailText = memo
+ ? resolveMemoContentMarkdown(memo.contentJson, memo.contentMarkdown) || memo.contentText || "没有正文内容"
+ : "没有正文内容";
const searchMatches = useMemo(() => getTextSearchMatches(detailText, searchQuery), [detailText, searchQuery]);
const searchMatchLabel = searchQuery.trim() ? `${searchMatches.length > 0 ? activeMatchIndex + 1 : 0}/${searchMatches.length}` : "0/0";
const syncStatusLabel = isSaving || syncStatus === "syncing"
diff --git a/packages/shared/src/content.test.mjs b/packages/shared/src/content.test.mjs
index 990e5616..bc5c8cdd 100644
--- a/packages/shared/src/content.test.mjs
+++ b/packages/shared/src/content.test.mjs
@@ -86,6 +86,13 @@ describe("legacy Markdown body recovery", () => {
expect(resolveMemoContentMarkdown(richContent, "")).toContain("这段正文只保存在富文本 JSON 中。");
});
+
+ test("keeps JSON divider nodes when the Markdown compatibility copy is stale", () => {
+ const richContent = markdownToDoc("第一篇正文\n\n---\n\n第二篇正文");
+ const resolved = resolveMemoContentMarkdown(richContent, "第一篇正文 第二篇正文");
+
+ expect(resolved).toContain("第一篇正文\n\n---\n\n第二篇正文");
+ });
});
describe("Nested list Markdown conversion", () => {