提交 1186e57d authored 作者: 王鹏飞's avatar 王鹏飞

fix(admin): initialize editor toolbar presentation

上级 78ad377b
......@@ -92,7 +92,7 @@ const WangEditorCustomer = (props, ref) => {
}, [editor])
useEditorLifecycle({ editor, gData, disabled });
useToolbarPresentation({ toolbarRef, active: !isView && tabKey === "text" });
useToolbarPresentation({ toolbarRef, active: !isView && tabKey === "text", editor });
const tabKeyChange = (key) => {
setTabKey(key);
......
......@@ -33,11 +33,11 @@ export const applyToolbarPresentation = toolbar => {
})
}
export const useToolbarPresentation = ({ toolbarRef, active }) => {
export const useToolbarPresentation = ({ toolbarRef, active, editor }) => {
useEffect(() => {
if (!active) return
if (!active || !editor) return
const frame = requestAnimationFrame(() => applyToolbarPresentation(toolbarRef.current))
return () => cancelAnimationFrame(frame)
}, [active, toolbarRef])
}, [active, editor, toolbarRef])
}
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论