mirror of
https://github.com/penpot/penpot.git
synced 2026-04-01 00:50:50 +02:00
🐛 Guard against null focusNode/anchorNode in text-editor
This commit is contained in:
@@ -961,7 +961,7 @@ export class SelectionController extends EventTarget {
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isTextFocus() {
|
||||
return this.focusNode.nodeType === Node.TEXT_NODE;
|
||||
return this.focusNode != null && this.focusNode.nodeType === Node.TEXT_NODE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -970,7 +970,9 @@ export class SelectionController extends EventTarget {
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isTextAnchor() {
|
||||
return this.anchorNode.nodeType === Node.TEXT_NODE;
|
||||
return (
|
||||
this.anchorNode != null && this.anchorNode.nodeType === Node.TEXT_NODE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user