fix: matchesNode error in destroyed editor transaction

This commit is contained in:
Tom Moor
2024-03-08 20:45:21 -05:00
parent df9f8cbabc
commit 193bde0bd5

View File

@@ -457,11 +457,14 @@ export class Editor extends React.PureComponent<
state: this.createState(this.props.value),
editable: () => !this.props.readOnly,
nodeViews: this.nodeViews,
dispatchTransaction(transaction) {
dispatchTransaction(this: EditorView, transaction) {
if (this.isDestroyed) {
return;
}
// callback is bound to have the view instance as its this binding
const { state, transactions } = (
this.state as EditorState
).applyTransaction(transaction);
const { state, transactions } =
this.state.applyTransaction(transaction);
this.updateState(state);