| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /**
- * EditorPanel.tsx - 文档编辑面板(新版)
- *
- * 完全重写版本,直接集成BlockEditor替代旧的MDXEditor
- * 保持Props接口兼容,确保与App.tsx的集成不需要修改
- *
- * @module components/EditorPanel
- */
- import React from 'react';
- import { EditorWithOutline } from '../Editor/EditorWithOutline';
- import './EditorPanel.css';
- // ══════════════════════════════════════════════════════════════════════════════
- // Component Props
- // ══════════════════════════════════════════════════════════════════════════════
- export interface EditorPanelProps {
- /** 文档ID */
- documentId: string;
- /** 初始文档名称(可选,从聊天消息传递) */
- initialDocumentName?: string | null;
- /** 关闭回调 */
- onClose: () => void;
- }
- // ══════════════════════════════════════════════════════════════════════════════
- // Component
- // ══════════════════════════════════════════════════════════════════════════════
- /**
- * EditorPanel - 文档编辑面板
- *
- * 新版本:极简外壳,直接集成BlockEditor
- *
- * 变更说明:
- * - ✅ Props接口保持不变,与旧版本完全兼容
- * - ✅ 删除了WYSIWYGEditor(MDXEditor)
- * - ✅ 直接使用BlockEditor作为编辑器内核
- * - ✅ 保留文档大纲功能(由BlockEditor内部处理)
- *
- * @example
- * ```tsx
- * <EditorPanel
- * documentId="doc-123"
- * initialDocumentName="地质报告.docx"
- * onClose={() => closePreview()}
- * />
- * ```
- */
- export const EditorPanel: React.FC<EditorPanelProps> = ({
- documentId,
- initialDocumentName,
- onClose,
- }) => {
- return (
- <div className="editor-panel" data-testid="editor-panel">
- {/* 集成带大纲的编辑器 */}
- <EditorWithOutline
- documentId={documentId}
- documentName={initialDocumentName}
- defaultShowOutline={true}
- onClose={onClose}
- />
- </div>
- );
- };
- export default EditorPanel;
|