import { TPlateEditor } from 'platejs/react'; import { ToolbarConfig, ToolbarAlign } from '../../types/toolbar-config'; import { CustomToolbarButtons } from './plate-editor'; import { EditorPluginKit } from '../../types/plugin-types'; import * as React from 'react'; /** * 独立工具栏组件的属性 */ export interface StandaloneToolbarProps { /** 工具栏配置 */ config: ToolbarConfig; /** 编辑器实例(必需,用于共享编辑器状态和历史记录) */ editor?: TPlateEditor; /** 自定义插件列表(可选,仅在未提供 editor 时使用) */ plugins?: EditorPluginKit; /** 是否显示工具栏,默认 true */ showToolbar?: boolean; /** 工具栏是否吸顶,默认 true */ sticky?: boolean; /** 工具栏按钮对齐方式,默认 left */ align?: ToolbarAlign; /** 工具栏是否占据全宽,默认 false */ fullWidth?: boolean; /** 自定义工具栏的 CSS 类名 */ className?: string; /** 自定义工具栏的内联样式对象 */ style?: React.CSSProperties; /** 自定义工具栏按钮 */ customButtons?: CustomToolbarButtons; } /** * 独立工具栏组件 * 可以在编辑器组件外部独立使用,提供完整的工具栏功能 * * 重要:当与外部编辑器一起使用时,必须传入 editor 实例以共享历史记录和状态 * * @example * ```tsx * // 与编辑器实例关联(推荐用法) * const editorRef = useRef(null); * const [editor, setEditor] = useState(null); * * * { * editorRef.current = ref; * if (ref) { * setEditor(ref.getEditor()); * } * }} * showToolbar={false} * /> * * // 独立使用(不推荐,历史记录不共享) * * ``` */ export declare const StandaloneToolbar: React.ForwardRefExoticComponent>;