1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-15 11:44:05 +02:00

Fix Hot Module Reload for plugins (#2825)

* Fix HMR for plugins

* Use TheReactPlugin in resolveController argument inside method
This commit is contained in:
Sunny Hirai
2019-05-22 18:57:29 -07:00
committed by GitHub
parent 96cb419ccb
commit 80212943cc

View File

@@ -145,7 +145,15 @@ class Editor extends React.Component {
// Re-resolve the controller if needed based on memoized props.
const { commands, placeholder, plugins, queries, schema } = this.props
this.resolveController(plugins, schema, commands, queries, placeholder)
this.resolveController(
plugins,
schema,
commands,
queries,
placeholder,
ReactPlugin
)
// Set the current props on the controller.
const { options, readOnly, value: valueFromProps } = this.props
@@ -208,7 +216,7 @@ class Editor extends React.Component {
*/
resolveController = memoizeOne(
(plugins = [], schema, commands, queries, placeholder) => {
(plugins = [], schema, commands, queries, placeholder, TheReactPlugin) => {
// If we've resolved a few times already, and it's exactly in line with
// the updates, then warn the user that they may be doing something wrong.
warning(
@@ -217,7 +225,7 @@ class Editor extends React.Component {
)
this.tmp.resolves++
const react = ReactPlugin({
const react = TheReactPlugin({
...this.props,
editor: this,
value: this.props.value || this.state.value,