import { Suspense, type JSX, type Ref } from 'react' import { useAppStore } from '@/store' import { findWorktreeById } from '@/store/slices/worktree-helpers' import type { OpenFile } from '@/store/slices/editor' import { EditorContent } from './EditorContent' import { EditorPanelHeader } from './EditorPanelHeader' import { UntitledFileRenameDialog } from './UntitledFileRenameDialog' import type { getEditorPanelRenderModel } from './editor-panel-render-model' import type { DiffContent, FileContent } from './editor-panel-content-types' import type { EditorToggleValue } from './EditorViewToggle' import { getUntitledFileRoot } from './untitled-file-rename-path' import { translate } from '@/i18n/i18n' type EditorPanelRenderModel = ReturnType type EditorPanelShellProps = { panelRef: Ref activeFile: OpenFile activeViewStateId: string | null | undefined model: EditorPanelRenderModel copiedPathVisible: boolean showMarkdownTableOfContents: boolean canShowMarkdownFrontmatterToggle: boolean markdownFrontmatterVisible: boolean sideBySide: boolean openFiles: OpenFile[] fileContents: Record diffContents: Record editorDrafts: Record pendingEditorReveal: ReturnType['pendingEditorReveal'] renameDialogFile: OpenFile | null renameError: string | null disableRenameBrowse: boolean onCopyPath: () => void onOpenDiffTargetFile: (preferredMarkdownViewMode?: 'rich') => void onOpenPreviewToSide: () => void onOpenMarkdownPreview: () => void onOpenContainingFolder: () => void onToggleSideBySide: () => void onEditorToggleChange: (next: EditorToggleValue) => void onToggleMarkdownTableOfContents: () => void onToggleMarkdownFrontmatter: () => void onExportMarkdownToPdf: () => void onContentChange: (content: string) => void onContentChangeForFile: (file: OpenFile, content: string) => void onDirtyStateHint: (dirty: boolean) => void onSave: (content: string) => Promise onSaveForFile: (file: OpenFile, content: string) => Promise onReloadContent: (file: OpenFile) => void onCloseMarkdownTableOfContents: () => void onCloseRenameDialog: () => void onRenameConfirm: (newRelPath: string) => Promise markdownAnnotationsEnabled: boolean } export function EditorPanelShell({ panelRef, activeFile, activeViewStateId, model, copiedPathVisible, showMarkdownTableOfContents, canShowMarkdownFrontmatterToggle, markdownFrontmatterVisible, sideBySide, openFiles, fileContents, diffContents, editorDrafts, pendingEditorReveal, renameDialogFile, renameError, disableRenameBrowse, onCopyPath, onOpenDiffTargetFile, onOpenPreviewToSide, onOpenMarkdownPreview, onOpenContainingFolder, onToggleSideBySide, onEditorToggleChange, onToggleMarkdownTableOfContents, onToggleMarkdownFrontmatter, onExportMarkdownToPdf, onContentChange, onContentChangeForFile, onDirtyStateHint, onSave, onSaveForFile, onReloadContent, onCloseMarkdownTableOfContents, onCloseRenameDialog, onRenameConfirm, markdownAnnotationsEnabled }: EditorPanelShellProps): JSX.Element { return (
{!model.isCombinedDiff && activeFile.mode !== 'check-details' && ( )} }>
) } function EditorLoadingFallback(): JSX.Element { return (
{translate('auto.components.editor.EditorPanelShell.e2c4dec350', 'Loading editor...')}
) }