mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-15 19:54:02 +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:
@@ -145,7 +145,15 @@ class Editor extends React.Component {
|
|||||||
|
|
||||||
// Re-resolve the controller if needed based on memoized props.
|
// Re-resolve the controller if needed based on memoized props.
|
||||||
const { commands, placeholder, plugins, queries, schema } = this.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.
|
// Set the current props on the controller.
|
||||||
const { options, readOnly, value: valueFromProps } = this.props
|
const { options, readOnly, value: valueFromProps } = this.props
|
||||||
@@ -208,7 +216,7 @@ class Editor extends React.Component {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
resolveController = memoizeOne(
|
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
|
// 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.
|
// the updates, then warn the user that they may be doing something wrong.
|
||||||
warning(
|
warning(
|
||||||
@@ -217,7 +225,7 @@ class Editor extends React.Component {
|
|||||||
)
|
)
|
||||||
|
|
||||||
this.tmp.resolves++
|
this.tmp.resolves++
|
||||||
const react = ReactPlugin({
|
const react = TheReactPlugin({
|
||||||
...this.props,
|
...this.props,
|
||||||
editor: this,
|
editor: this,
|
||||||
value: this.props.value || this.state.value,
|
value: this.props.value || this.state.value,
|
||||||
|
Reference in New Issue
Block a user