Commit b99b0aa3 authored by 满振华's avatar 满振华

修改子空间

parent 8651474a
......@@ -33,7 +33,7 @@ interface IProps {
onChange?: Function
}
const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef, excludeControls = excludeControlsDefault }) => {
const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef, excludeControls = excludeControlsDefault, ...others }) => {
// 创建一个空的editorState作为初始值
const [editorState, setEditorState] = useState(BraftEditor.createEditorState(null));
const [percent, setPercent] = useState(0); // 进度条
......@@ -102,17 +102,23 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef,
),
},
];
const insertText = (text: string) => {
setEditorState(ContentUtils.insertText(editorState, text))
}
// 向外抛出数据
useImperativeHandle(cRef, () => {
return {
getHtml,
previewMth,
insertText,
};
});
return (
<div className={styles.box}>
<BraftEditor
{...others}
id="editor-with-color-picker"
value={editorState}
excludeControls={excludeControls}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment