AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
feat(mobile): share notes from list context menu
tianma-iff09786051b36
diff --git a/apps/mobile/src/lib/mobile-locale.tsx b/apps/mobile/src/lib/mobile-locale.tsxindex 31cc3f65..5ec31bfb 100644--- a/apps/mobile/src/lib/mobile-locale.tsx+++ b/apps/mobile/src/lib/mobile-locale.tsx@@ -83,6 +83,8 @@ const mobileOnlyTranslations = new Map<string, string>([["AI 笔记助手", "AI note assistant"],["版本历史", "Version history"],["分享笔记", "Share note"],+ ["分享为图片", "Share as image"],+ ["选择笔记", "Select note"],["复制笔记 ID", "Copy note ID"],["同步后可复制笔记 ID", "Copy note ID after sync"],["笔记 ID 已复制", "Note ID copied"],@@ -316,6 +318,8 @@ const mobileOnlyJapanese = new Map<string, string>([["AI 笔记助手", "AI ノートアシスタント"],["版本历史", "版履歴"],["分享笔记", "ノートを共有"],+ ["分享为图片", "画像として共有"],+ ["选择笔记", "ノートを選択"],["复制笔记 ID", "ノート ID をコピー"],["同步后可复制笔记 ID", "同期後にノート ID をコピー"],["笔记 ID 已复制", "ノート ID をコピーしました"],@@ -548,6 +552,8 @@ const mobileOnlyPolish = new Map<string, string>([["AI 笔记助手", "Asystent AI notatek"],["版本历史", "Historia wersji"],["分享笔记", "Udostępnij notatkę"],+ ["分享为图片", "Udostępnij jako obraz"],+ ["选择笔记", "Wybierz notatkę"],["复制笔记 ID", "Kopiuj ID notatki"],["同步后可复制笔记 ID", "ID notatki można skopiować po synchronizacji"],["笔记 ID 已复制", "Skopiowano ID notatki"],diff --git a/apps/mobile/src/screens/WorkspaceActionSheets.tsx b/apps/mobile/src/screens/WorkspaceActionSheets.tsxindex 5685518b..b30cee4e 100644--- a/apps/mobile/src/screens/WorkspaceActionSheets.tsx+++ b/apps/mobile/src/screens/WorkspaceActionSheets.tsx@@ -1,7 +1,7 @@import type { ReactNode } from "react";import type { MemoSortMode } from "@edgeever/client";import { Modal, ScrollView, View } from "react-native";-import { Check, CheckSquare, FileText, Folder, List, MoreVertical, Sparkles, Tag, Trash2, X } from "../components/icons";+import { Check, CheckSquare, FileText, Folder, Image, List, MoreVertical, Share2, Sparkles, Tag, Trash2, X } from "../components/icons";import { Pressable, Text } from "../components/LocalizedText";import type { MobileMemoListDensity } from "../lib/preferences";import { styles } from "./workspace-styles";@@ -154,6 +154,51 @@ export const NotesActionsModal = ({</Modal>);+export const MemoContextActionsModal = ({+ bottomOffset,+ canShare,+ memoTitle,+ onClose,+ onSelect,+ onShare,+ onShareImage,+ visible,+}: {+ bottomOffset: number;+ canShare: boolean;+ memoTitle: string;+ onClose: () => void;+ onSelect: () => void;+ onShare: () => void;+ onShareImage: () => void;+ visible: boolean;+}) => (+ <Modal animationType="fade" onRequestClose={onClose} transparent visible={visible}>+ <Pressable onPress={onClose} style={[styles.actionSheetBackdrop, { paddingBottom: bottomOffset }]}>+ <Pressable style={styles.listActionSheet}>+ <View style={styles.actionSheetHandle} />+ <View style={styles.listActionSheetHeader}>+ <View style={styles.listActionSheetHeaderText}>+ <Text numberOfLines={1} style={styles.actionSheetTitle}>笔记操作</Text>+ <Text numberOfLines={1} style={styles.actionSheetSubtitle}>{memoTitle}</Text>+ </View>+ <Pressable accessibilityLabel="关闭" accessibilityRole="button" onPress={onClose} style={styles.sheetCloseButton}>+ <X color="#0f172a" size={18} />+ </Pressable>+ </View>+ {canShare ? (+ <>+ <ActionSheetItem icon={<Share2 color="#0f172a" size={18} />} label="分享笔记" onPress={onShare} />+ <ActionSheetItem icon={<Image color="#0f172a" size={18} />} label="分享为图片" onPress={onShareImage} />+ <View style={styles.listActionDivider} />+ </>+ ) : null}+ <ActionSheetItem icon={<CheckSquare color="#0f172a" size={18} />} label="选择笔记" onPress={onSelect} />+ </Pressable>+ </Pressable>+ </Modal>+);+const SelectionAction = ({danger = false,disabled = false,diff --git a/apps/mobile/src/screens/WorkspaceMemoDetail.tsx b/apps/mobile/src/screens/WorkspaceMemoDetail.tsxindex c874406a..39586626 100644--- a/apps/mobile/src/screens/WorkspaceMemoDetail.tsx+++ b/apps/mobile/src/screens/WorkspaceMemoDetail.tsx@@ -405,6 +405,7 @@ const HighlightedMetadataText = ({export const MemoDetailModal = ({editingSession,imageCompressionEnabled,+ imageShareFromList,initialSearchQuery,isDeleting,isLoading,@@ -439,6 +440,7 @@ export const MemoDetailModal = ({memo: MemoDetail;} | null;imageCompressionEnabled: boolean;+ imageShareFromList: boolean;initialSearchQuery: string;isDeleting: boolean;isLoading: boolean;@@ -498,6 +500,7 @@ export const MemoDetailModal = ({const [viewerGeneration, setViewerGeneration] = useState(0);const viewerRef = useRef<LocalTiptapEditorRef>(null);const imageExportIntentRef = useRef<"preview" | "share">("share");+ const imageShareOpenedMemoRef = useRef<string | null>(null);const imageExportRequestRef = useRef<string | null>(null);const imageExportChunksRef = useRef<string[]>([]);const imageExportTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);@@ -681,6 +684,29 @@ export const MemoDetailModal = ({if (!visible) setTitleCollapsed(false);}, [visible]);+ useEffect(() => {+ if (!imageShareFromList || !visible) {+ imageShareOpenedMemoRef.current = null;+ return;+ }+ if (!memo || !viewerReady || imageShareOpenedMemoRef.current === memo.id) return;+ imageShareOpenedMemoRef.current = memo.id;+ setImageShareOptionsOpen(true);+ }, [imageShareFromList, memo, viewerReady, visible]);++ const closeImageShareOptions = () => {+ setImageShareOptionsOpen(false);+ if (imageShareFromList) onClose();+ };++ const closeImagePreview = () => {+ setPreparedNoteImage(null);+ if (imageShareFromList) {+ setImageShareOptionsOpen(false);+ onClose();+ }+ };+useEffect(() => {if (!isEditing) {return;@@ -778,11 +804,22 @@ export const MemoDetailModal = ({useEffect(() => clearImageExportTimeout, [clearImageExportTimeout]);+ useEffect(() => {+ if (visible) return;+ clearImageExportTimeout();+ imageExportRequestRef.current = null;+ imageExportChunksRef.current = [];+ setIsExportingImage(false);+ setImageShareOptionsOpen(false);+ setPreparedNoteImage(null);+ }, [clearImageExportTimeout, visible]);+const failImageExport = useCallback((message?: string) => {clearImageExportTimeout();imageExportChunksRef.current = [];imageExportRequestRef.current = null;setIsExportingImage(false);+ if (imageShareFromList) setImageShareOptionsOpen(true);const localizedMessage = message === "NOTE_IMAGE_TOO_LONG"? (resolvedLocale !== "zh-CN"? "This note is too long for one readable image. Choose a smaller font size or split the note."@@ -792,7 +829,7 @@ export const MemoDetailModal = ({resolvedLocale !== "zh-CN" ? "Image export failed" : "导出笔记图片失败",localizedMessage || (resolvedLocale !== "zh-CN" ? "Try again later." : "请稍后重试。"));- }, [clearImageExportTimeout, resolvedLocale]);+ }, [clearImageExportTimeout, imageShareFromList, resolvedLocale]);const handleImageExportEvent = useCallback(async (payloadJson: string) => {let event: MobileImageExportEvent;@@ -1426,8 +1463,14 @@ export const MemoDetailModal = ({</Pressable></Modal>) : null}- <Modal animationType="fade" onRequestClose={() => setImageShareOptionsOpen(false)} transparent visible={imageShareOptionsOpen}>- <Pressable onPress={() => setImageShareOptionsOpen(false)} style={styles.actionSheetBackdrop}>+ <Modal animationType="fade" onRequestClose={closeImageShareOptions} transparent visible={imageShareOptionsOpen}>+ <Pressable+ onPress={closeImageShareOptions}+ style={[+ styles.actionSheetBackdrop,+ { paddingBottom: Math.max(safeAreaInsets.bottom, Platform.OS === "android" ? ANDROID_SYSTEM_NAVIGATION_FALLBACK : 0) },+ ]}+ ><Pressable style={[styles.actionSheet, imageShareStyles.sheetContainer]}><View style={styles.actionSheetHandle} /><Text style={styles.actionSheetTitle}>{resolvedLocale !== "zh-CN" ? "Share as image" : "分享为图片"}</Text>@@ -1534,7 +1577,7 @@ export const MemoDetailModal = ({<PressableaccessibilityRole="button"- disabled={isExportingImage}+ disabled={isExportingImage || !viewerReady}onPress={() => {setImageShareOptionsOpen(false);exportMemoImage(imageShareFormat, {@@ -1550,22 +1593,24 @@ export const MemoDetailModal = ({intent: "preview",});}}- style={[imageShareStyles.shareButton, isExportingImage && styles.buttonDisabled]}+ style={[imageShareStyles.shareButton, (isExportingImage || !viewerReady) && styles.buttonDisabled]}><Share2 color="#ffffff" size={18} /><Text style={imageShareStyles.shareButtonText}>- {resolvedLocale !== "zh-CN" ? "Generate preview" : "生成预览"}+ {!viewerReady+ ? (resolvedLocale !== "zh-CN" ? "Preparing note…" : "正在准备笔记…")+ : (resolvedLocale !== "zh-CN" ? "Generate preview" : "生成预览")}</Text></Pressable></ScrollView></Pressable></Pressable></Modal>- <Modal animationType="slide" onRequestClose={() => setPreparedNoteImage(null)} presentationStyle="fullScreen" visible={Boolean(preparedNoteImage)}>+ <Modal animationType="slide" onRequestClose={closeImagePreview} presentationStyle="fullScreen" visible={Boolean(preparedNoteImage)}><SafeAreaView style={imageShareStyles.previewSafeArea}><View style={imageShareStyles.previewHeader}><Text style={imageShareStyles.previewTitle}>{resolvedLocale !== "zh-CN" ? "Image preview" : "图片预览"}</Text>- <Pressable accessibilityLabel={resolvedLocale !== "zh-CN" ? "Close preview" : "关闭预览"} accessibilityRole="button" onPress={() => setPreparedNoteImage(null)} style={imageShareStyles.previewCloseButton}>+ <Pressable accessibilityLabel={resolvedLocale !== "zh-CN" ? "Close preview" : "关闭预览"} accessibilityRole="button" onPress={closeImagePreview} style={imageShareStyles.previewCloseButton}><X color="#0f172a" size={22} /></Pressable></View>@@ -1732,14 +1777,14 @@ export const MemoDetailModal = ({const imageShareStyles = StyleSheet.create({sheetContainer: {- maxHeight: "85%",+ height: "85%",paddingBottom: 24,},optionsContent: {- paddingBottom: 4,+ paddingBottom: 48,},optionsScroll: {- flexShrink: 1,+ flex: 1,},themeGrid: {flexDirection: "row",diff --git a/apps/mobile/src/screens/WorkspaceNotesView.tsx b/apps/mobile/src/screens/WorkspaceNotesView.tsxindex 62f0ea4e..4fb6273e 100644--- a/apps/mobile/src/screens/WorkspaceNotesView.tsx+++ b/apps/mobile/src/screens/WorkspaceNotesView.tsx@@ -3,6 +3,7 @@ import type { MemoFilterMode, MemoSortMode } from "@edgeever/client";import { DEFAULT_MEMO_TITLE, getMemoListTimestamp, getNotebookDescendantMemoCount, type MemoSummary, type Notebook } from "@edgeever/shared";import { MOBILE_UI_METRICS, toggleMobileMemoFilterMode } from "@edgeever/shared/mobile-ui";import { FlatList, Platform, RefreshControl, View } from "react-native";+import { Gesture, GestureDetector, MouseButton, PointerType } from "react-native-gesture-handler";import { ActivityIndicator, Check, ChevronDown, ChevronLeft, LayoutTemplate, MoreHorizontal, Plus, RotateCcw, Search, Sparkles, Tag, X } from "../components/icons";import { Pressable, Text, TextInput } from "../components/LocalizedText";import type { MobileBootstrapProgress } from "../lib/local-mirror";@@ -442,67 +443,76 @@ const MemoCard = memo(function MemoCard({? (resolvedLocale !== "zh-CN" ? "Created" : "创建"): (resolvedLocale !== "zh-CN" ? "Updated" : "更新");const handledLongPressRef = useRef(false);+ const rightClickGesture = Gesture.Tap()+ .mouseButton(MouseButton.RIGHT)+ .runOnJS(true)+ .onEnd((event, success) => {+ if (success && event.pointerType === PointerType.MOUSE && !selectionMode) onLongPress?.();+ });return (- <View- style={[- styles.memoCard,- listDensity === "compact" && styles.memoCardCompact,- selected && styles.memoCardSelected,- ]}- >- {selectionMode ? (+ <GestureDetector gesture={rightClickGesture}>+ <View+ style={[+ styles.memoCard,+ listDensity === "compact" && styles.memoCardCompact,+ selected && styles.memoCardSelected,+ ]}+ >+ {selectionMode ? (+ <Pressable+ accessibilityLabel={`${selected ? "取消选择" : "选择"} ${memoTitle}`}+ accessibilityRole="button"+ accessibilityState={{ selected }}+ onPress={onPress}+ style={styles.memoSelectionButton}+ >+ <View style={[styles.selectionIndicator, selected && styles.selectionIndicatorActive]}>+ {selected ? <Check color="#ffffff" size={14} /> : null}+ </View>+ </Pressable>+ ) : null}<Pressable- accessibilityLabel={`${selected ? "取消选择" : "选择"} ${memoTitle}`}+ accessibilityHint={selectionMode ? undefined : (resolvedLocale !== "zh-CN" ? "Long press for note actions" : "长按打开笔记操作")}+ accessibilityLabel={memoTitle}accessibilityRole="button"- accessibilityState={{ selected }}- onPress={onPress}- style={styles.memoSelectionButton}+ delayLongPress={520}+ onLongPress={() => {+ handledLongPressRef.current = true;+ onLongPress?.();+ }}+ onPress={() => {+ if (handledLongPressRef.current) {+ handledLongPressRef.current = false;+ return;+ }+ onPress();+ }}+ style={[styles.memoCardContent, listDensity === "compact" && styles.memoCardContentCompact, selectionMode && styles.memoCardContentWithSelection]}>- <View style={[styles.selectionIndicator, selected && styles.selectionIndicatorActive]}>- {selected ? <Check color="#ffffff" size={14} /> : null}+ <View style={styles.memoCardTop}>+ {memo.isPinned ? (+ <Text accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={styles.memoPinnedStar}>★</Text>+ ) : null}+ <Text numberOfLines={1} style={styles.memoTitle}>+ {memoTitle}+ </Text></View>- </Pressable>- ) : null}- <Pressable- accessibilityLabel={memoTitle}- accessibilityRole="button"- delayLongPress={520}- onLongPress={() => {- handledLongPressRef.current = true;- onLongPress?.();- }}- onPress={() => {- if (handledLongPressRef.current) {- handledLongPressRef.current = false;- return;- }- onPress();- }}- style={[styles.memoCardContent, listDensity === "compact" && styles.memoCardContentCompact, selectionMode && styles.memoCardContentWithSelection]}- >- <View style={styles.memoCardTop}>- {memo.isPinned ? (- <Text accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={styles.memoPinnedStar}>★</Text>- ) : null}- <Text numberOfLines={1} style={styles.memoTitle}>- {memoTitle}- </Text>- </View>- {listDensity === "preview" ? (- <Text numberOfLines={2} style={styles.memoExcerpt}>- {memo.excerpt || "空笔记"}- </Text>- ) : null}- <View style={[styles.memoMeta, listDensity === "compact" && styles.memoMetaCompact]}>- <Text style={styles.memoDate}>{listTimestampKind} {listTimestampLabel}</Text>- {memo.tags.slice(0, 3).map((tag) => (- <Text key={tag} style={styles.tag}>- #{tag}+ {listDensity === "preview" ? (+ <Text numberOfLines={2} style={styles.memoExcerpt}>+ {memo.excerpt || "空笔记"}</Text>- ))}- </View>- </Pressable>- </View>+ ) : null}+ <View style={[styles.memoMeta, listDensity === "compact" && styles.memoMetaCompact]}>+ <Text style={styles.memoDate}>{listTimestampKind} {listTimestampLabel}</Text>+ {memo.tags.slice(0, 3).map((tag) => (+ <Text key={tag} style={styles.tag}>+ #{tag}+ </Text>+ ))}+ </View>+ </Pressable>+ </View>+ </GestureDetector>);}, (previous, next) =>previous.memo === next.memo &&diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsxindex d777d696..0092744b 100644--- a/apps/mobile/src/screens/WorkspaceScreen.tsx+++ b/apps/mobile/src/screens/WorkspaceScreen.tsx@@ -19,7 +19,7 @@ import {import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";import { Alert, Pressable, Text } from "../components/LocalizedText";import { ApiRequestError } from "@edgeever/client";-import { DEFAULT_MEMO_TITLE, getNotebookScopeIds, hasDiagramDocumentMarker, markdownToDoc, type MemoDetail, type Notebook } from "@edgeever/shared";+import { DEFAULT_MEMO_TITLE, getNotebookScopeIds, hasDiagramDocumentMarker, markdownToDoc, type MemoDetail, type MemoSummary, type Notebook } from "@edgeever/shared";import { MOBILE_UI_METRICS, toggleMobileMemoFilterMode } from "@edgeever/shared/mobile-ui";import { clearMobileMemoDraft, readMobileMemoDraft, type MobileMemoDraft } from "../lib/mobile-drafts";import {@@ -111,6 +111,7 @@ import {import { RevisionHistoryModal } from "./WorkspaceRevisionHistory";import { CreateMemoModal } from "./WorkspaceEditors";import {+ MemoContextActionsModal,NotesActionsModal,SelectionActionBar,SelectionMoreModal,@@ -165,6 +166,8 @@ export const WorkspaceScreen = ({const [showDescendantNotes, setShowDescendantNotes] = useState<boolean | null>(null);const [showDescendantNotesSaveFailed, setShowDescendantNotesSaveFailed] = useState(false);const [selectedMemoId, setSelectedMemoId] = useState<string | null>(null);+ const [contextMemo, setContextMemo] = useState<MemoSummary | null>(null);+ const [imageShareFromList, setImageShareFromList] = useState(false);const [searchText, setSearchText] = useState("");const [createOpen, setCreateOpen] = useState(false);const [createSeed, setCreateSeed] = useState<MobileCreateMemoSeed | null>(null);@@ -401,6 +404,7 @@ export const WorkspaceScreen = ({return;}+ setImageShareFromList(false);setSelectedMemoId(memoId);};@@ -449,6 +453,7 @@ export const WorkspaceScreen = ({const closeDetail = () => {setSelectedMemoId(null);+ setImageShareFromList(false);};const closeRichEditor = () => {@@ -995,7 +1000,7 @@ export const WorkspaceScreen = ({});const shareMemoMutation = useMutation({- mutationFn: async (memo: MemoDetail) => {+ mutationFn: async (memo: Pick<MemoSummary, "id" | "title">) => {if (!client || !session) {throw new Error("Client is not ready");}@@ -1263,7 +1268,7 @@ export const WorkspaceScreen = ({onMemoPress={handleMemoPress}onMemoLongPress={(memo) => {Vibration.vibrate(8);- selectSingleMemo(memo.id);+ setContextMemo(memo);}}onLoadMore={() => {const query = searchActive ? searchQuery : memosQuery;@@ -1308,6 +1313,7 @@ export const WorkspaceScreen = ({<MemoDetailModaleditingSession={richEditingSession}imageCompressionEnabled={imageCompressionEnabled}+ imageShareFromList={imageShareFromList}initialSearchQuery={selectedMemoId ? searchText.trim() : ""}isDeleting={deleteMemoMutation.isPending}isLoading={memoDetailQuery.isLoading}@@ -1339,6 +1345,29 @@ export const WorkspaceScreen = ({visible={Boolean(selectedMemoId)}/>+ {contextMemo ? (+ <MemoContextActionsModal+ bottomOffset={52 + safeAreaInsets.bottom}+ canShare={!contextMemo.isDeleted}+ memoTitle={localizeUntitledMemoTitle(contextMemo.title, resolvedLocale)}+ onClose={() => setContextMemo(null)}+ onSelect={() => {+ selectSingleMemo(contextMemo.id);+ setContextMemo(null);+ }}+ onShare={() => {+ shareMemoMutation.mutate(contextMemo);+ setContextMemo(null);+ }}+ onShareImage={() => {+ setContextMemo(null);+ setImageShareFromList(true);+ setSelectedMemoId(contextMemo.id);+ }}+ visible+ />+ ) : null}+{notebookPickerOpen ? <NotebookPickerModalactiveNotebookId={activeNotebookId}notebooks={notebooks}