mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix(react): fix performance regression because of select/deselect (#4661)
This commit is contained in:
parent
b2e3b7e23f
commit
ad7f659ed0
@ -134,8 +134,16 @@ class ReactNodeView extends NodeView<
|
|||||||
const { from, to } = this.editor.state.selection
|
const { from, to } = this.editor.state.selection
|
||||||
|
|
||||||
if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
|
if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
|
||||||
|
if (this.renderer.props.selected) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.selectNode()
|
this.selectNode()
|
||||||
} else {
|
} else {
|
||||||
|
if (!this.renderer.props.selected) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.deselectNode()
|
this.deselectNode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user