当前为阅读态,编辑器仅在进入编辑后挂载。
\\n ) : null}\\n最近更新:{formattedUpdatedAt}
\\n \\n {canEditDocument && (\\n该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : !isEditing && canEditDocument ? (\\n当前为阅读态,编辑器仅在进入编辑后挂载。
\\n ) : null}\\n最近更新:{formattedUpdatedAt}
\\n该页面为只读共享,无法编辑。
\",\n \"- ) : options.protectEditing && isEditing ? (\",\n \"-当前页面已开启编辑保护,关闭后方可修改内容。
\",\n \"- ) : !isEditing && canEditDocument ? (\",\n \"-当前为阅读态,编辑器仅在进入编辑后挂载。
\",\n \"- ) : null}\",\n \"-最近更新:{formattedUpdatedAt}
\",\n \"-该页面为只读共享,无法编辑。
\",\n \"+ ) : options.protectEditing && isEditing ? (\",\n \"+当前页面已开启编辑保护,关闭后方可修改内容。
\",\n \"+ ) : !isEditing && canEditDocument ? (\",\n \"+当前为阅读态,编辑器仅在进入编辑后挂载。
\",\n \"+ ) : null}\",\n \"+最近更新:{formattedUpdatedAt}
\",\n \"+该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : null}\\n\",\"old_string\":\" {readOnly ? (\\n该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : !isEditing && canEditDocument ? (\\n当前为阅读态,编辑器仅在进入编辑后挂载。
\\n ) : null}\\n\",\"path\":\"/mnt/Data1T/mnote/wolai-frontend/src/components/editor/document-content.tsx\",\"replace_all\":false}","name":"edit_file","type":"tool_use"}],"role":"assistant","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":113759,"output_tokens":280}},"type":"message"} {"message":{"blocks":[{"is_error":false,"output":"{\n \"filePath\": \"/mnt/Data1T/mnote/wolai-frontend/src/components/editor/document-content.tsx\",\n \"oldString\": \" {readOnly ? (\\n该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : !isEditing && canEditDocument ? (\\n当前为阅读态,编辑器仅在进入编辑后挂载。
\\n ) : null}\\n\",\n \"newString\": \" {readOnly ? (\\n该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : null}\\n\",\n \"originalFile\": \"\\\"use client\\\";\\n\\nimport dynamic from \\\"next/dynamic\\\";\\nimport { useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent, type KeyboardEvent as ReactKeyboardEvent } from \\\"react\\\";\\nimport type { BooleanPageOptionKey, DocumentStats, PageOptionsState, PageFont, PageLayoutDensity } from \\\"@/types/page-options\\\";\\nimport { useEditorBridgeStore } from \\\"@/store/editor-bridge\\\";\\nimport { usePageLayoutStore } from \\\"@/store/page-layout\\\";\\nimport { useCurrentDocumentStore } from \\\"@/store/current-document\\\";\\nimport type { Json } from \\\"@/types/supabase\\\";\\nimport type { DocumentSnapshot } from \\\"@/types/document\\\";\\nimport { useDebouncedCallback } from \\\"@/hooks/use-debounced-callback\\\";\\nimport { ImagePickerProvider } from \\\"@/components/media/image-picker-context\\\";\\nimport { useRouter } from \\\"next/navigation\\\";\\nimport { DocumentAiAgentPanel } from \\\"./DocumentAiAgentPanel\\\";\\nimport { CONTENT_LOADING_DELAY_MS } from \\\"@/lib/constants\\\";\\nimport { useCommentsUiStore } from \\\"@/store/comments-ui\\\";\\nimport { useAppPreferencesStore } from \\\"@/store/app-preferences\\\";\\nimport { useMoveEmbedPickerStore } from \\\"@/store/move-embed-picker\\\";\\nimport { cn } from \\\"@/lib/utils\\\";\\nimport { Button } from \\\"@/components/ui/button\\\";\\nimport { DocumentToc } from \\\"@/components/editor/document-toc\\\";\\nimport { DocumentReadView } from \\\"@/components/editor/document-read-view\\\";\\nimport { extractPageBlocks, type PageSubtreeProjection } from \\\"@/lib/documents/page-subtree\\\";\\nimport {\\n deleteDocumentCommand,\\n embedDocumentCommand,\\n moveDocumentCommand,\\n renameDocumentCommand,\\n} from \\\"@/lib/documents/tree-command-client\\\";\\nimport { EditorHost } from \\\"@/components/editor/editor-host\\\";\\n\\nconst PageOptionsSidebar = dynamic(\\n () => import(\\\"@/components/editor/page-options-sidebar\\\").then((mod) => mod.PageOptionsSidebar),\\n { ssr: false },\\n);\\n\\nconst PageBacklinksPanel = dynamic(\\n () => import(\\\"@/components/editor/page-backlinks-panel\\\").then((mod) => mod.PageBacklinksPanel),\\n {\\n ssr: false,\\n loading: () => null,\\n },\\n);\\n\\nconst DocumentHistoryDrawer = dynamic(\\n () => import(\\\"@/components/editor/document-history-drawer\\\").then((mod) => mod.DocumentHistoryDrawer),\\n {\\n ssr: false,\\n loading: () => null,\\n },\\n);\\n\\nconst MoveEmbedPickerHost = dynamic(\\n () => import(\\\"@/components/documents/move-embed-picker-host\\\").then((mod) => mod.MoveEmbedPickerHost),\\n {\\n ssr: false,\\n loading: () => null,\\n },\\n);\\n\\nconst DocumentCommentsDrawer = dynamic(\\n () => import(\\\"@/components/editor/document-comments-drawer\\\").then((mod) => mod.DocumentCommentsDrawer),\\n {\\n ssr: false,\\n loading: () => null,\\n },\\n);\\n\\nexport interface DocumentContentProps {\\n documentId: string;\\n workspaceId: string;\\n title: string | null;\\n updatedAt: string | null;\\n initialContent: unknown;\\n initialContentRevision?: number | null;\\n initialConflictDetectionKey?: string | null;\\n initialPageSubtree?: PageSubtreeProjection | null;\\n initialOptions: PageOptionsState;\\n initialStats: DocumentStats | null;\\n openTableId?: string | null;\\n autoEnterEdit?: boolean;\\n readOnly?: boolean;\\n disableDownload?: boolean;\\n disableCopy?: boolean;\\n}\\n\\nconst defaultOptions: PageOptionsState = {\\n wideLayout: false,\\n smallText: false,\\n showHeadingNumbers: true,\\n showToc: false,\\n showStructure: false,\\n protectEditing: false,\\n showWordCount: true,\\n collapseBacklinks: false,\\n pageFont: \\\"default\\\",\\n layoutDensity: \\\"normal\\\",\\n hideChildPages: false,\\n showBlockRefCount: false,\\n embedDefaultBlockId: null,\\n};\\nconst defaultStats: DocumentStats = { wordCount: 0, characterCount: 0, blockCount: 0, todoTotal: 0, todoDone: 0 };\\nconst EDITOR_UNMOUNT_GRACE_MS = 1000;\\n\\nexport function DocumentContent({\\n documentId,\\n workspaceId,\\n title,\\n updatedAt,\\n initialContent,\\n initialContentRevision = null,\\n initialConflictDetectionKey = null,\\n initialPageSubtree = null,\\n initialOptions,\\n initialStats,\\n openTableId,\\n autoEnterEdit = false,\\n readOnly = false,\\n disableDownload = false,\\n disableCopy = false,\\n}: DocumentContentProps) {\\n const setCurrentDocument = useCurrentDocumentStore((state) => state.setCurrent);\\n const clearIfMatch = useCurrentDocumentStore((state) => state.clearIfMatch);\\n const canEditDocument = !readOnly;\\n const [options, setOptions] = useState该页面为只读共享,无法编辑。
\\n ) : options.protectEditing && isEditing ? (\\n当前页面已开启编辑保护,关闭后方可修改内容。
\\n ) : !isEditing && canEditDocument ? (\\n当前为阅读态,编辑器仅在进入编辑后挂载。
\\n ) : null}\\n最近更新:{formattedUpdatedAt}
\\n该页面为只读共享,无法编辑。
\",\n \"- ) : options.protectEditing && isEditing ? (\",\n \"-当前页面已开启编辑保护,关闭后方可修改内容。
\",\n \"- ) : !isEditing && canEditDocument ? (\",\n \"-当前为阅读态,编辑器仅在进入编辑后挂载。
\",\n \"- ) : null}\",\n \"-最近更新:{formattedUpdatedAt}
\",\n \"-该页面为只读共享,无法编辑。
\",\n \"+ ) : options.protectEditing && isEditing ? (\",\n \"+当前页面已开启编辑保护,关闭后方可修改内容。
\",\n \"+ ) : null}\",\n \"+最近更新:{formattedUpdatedAt}
\",\n \"+