Skip to content

Commit

Permalink
[Bug] n.closest() not a function #1317 (#1600)
Browse files Browse the repository at this point in the history
* Release 2.19.2 (#1597)

Save 2.19.2 changes

* 1317
The selection node sometimes ends up being the ShadowRoot which does not have the closest method.
In case it is the shadowroot - I believe we can assume the selection is not at the editor zone

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 8, 2021
1 parent aa5a3d0 commit d5aaa56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class SelectionUtils {

let editorZone = null;

if (selectedNode) {
if (selectedNode && selectedNode instanceof Element) {
editorZone = selectedNode.closest(`.${SelectionUtils.CSS.editorZone}`);
}

Expand Down

0 comments on commit d5aaa56

Please sign in to comment.