We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src/components/Editor.tsx路径文件内有一段赋值逻辑,只有editor未创建时才会执行,导致onChange函数之后无法更新,使用的一直是初始创建时组件内的值,相当于闭包了。从而在使用时,页面只能拿到初次创建编辑器时页面状态下的state,内部createEditor时能否给onChange包一层ref?
useEffect(() => { if (ref.current == null) return if (editor != null) return // 防止重复渲染 当编辑器已经创建就不在创建了 if (ref.current?.getAttribute('data-w-e-textarea')) return const newEditor = createEditor({ selector: ref.current, config: { ...defaultConfig, onCreated: handleCreated, onChange: handleChanged, onDestroyed: handleDestroyed, }, content: defaultContent, html: defaultHtml || value, mode, }) setEditor(newEditor) }, [editor])
大家有遇到的可以用ahooks中的useMemoizedFn包一下传递给onChange的参数
The text was updated successfully, but these errors were encountered:
No branches or pull requests
src/components/Editor.tsx路径文件内有一段赋值逻辑,只有editor未创建时才会执行,导致onChange函数之后无法更新,使用的一直是初始创建时组件内的值,相当于闭包了。从而在使用时,页面只能拿到初次创建编辑器时页面状态下的state,内部createEditor时能否给onChange包一层ref?
大家有遇到的可以用ahooks中的useMemoizedFn包一下传递给onChange的参数
The text was updated successfully, but these errors were encountered: