[Bug] n.closest() not a function #1317 (#1600)

* 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>
This commit is contained in:
Liam Martens 2021-04-08 21:13:00 +02:00 committed by GitHub
parent aa5a3d05f3
commit d5aaa56ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,7 +125,7 @@ export default class SelectionUtils {
let editorZone = null;
if (selectedNode) {
if (selectedNode && selectedNode instanceof Element) {
editorZone = selectedNode.closest(`.${SelectionUtils.CSS.editorZone}`);
}