Skip to content

Commit

Permalink
Fix React and Vue NodeView renderers not adding correct selection cla…
Browse files Browse the repository at this point in the history
…sses (#4452)

* fix(react): add correct / remove selected class
* fix(vue-2): add correct / remove selected class
* fix(vue-3): add correct / remove selected class
  • Loading branch information
bdbch committed Sep 15, 2023
1 parent a7156b3 commit 2e199b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react/src/ReactNodeViewRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ class ReactNodeView extends NodeView<
this.renderer.updateProps({
selected: true,
})
this.renderer.element.classList.add('ProseMirror-selectednode')
}

deselectNode() {
this.renderer.updateProps({
selected: false,
})
this.renderer.element.classList.remove('ProseMirror-selectednode')
}

destroy() {
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-2/src/VueNodeViewRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ class VueNodeView extends NodeView<Vue | VueConstructor, Editor, VueNodeViewRend
this.renderer.updateProps({
selected: true,
})
this.renderer.element.classList.add('ProseMirror-selectednode')
}

deselectNode() {
this.renderer.updateProps({
selected: false,
})
this.renderer.element.classList.remove('ProseMirror-selectednode')
}

getDecorationClasses() {
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-3/src/VueNodeViewRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ class VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions
this.renderer.updateProps({
selected: true,
})
this.renderer.element.classList.add('ProseMirror-selectednode')
}

deselectNode() {
this.renderer.updateProps({
selected: false,
})
this.renderer.element.classList.remove('ProseMirror-selectednode')
}

getDecorationClasses() {
Expand Down

0 comments on commit 2e199b0

Please sign in to comment.