From 36c476ad36e192a56fc92a2b5058e8b6dd5b36da Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Tue, 24 Mar 2020 01:59:39 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20Uncaught=20TypeError:=20Cannot=20read=20p?= =?UTF-8?q?roperty=20'nodeType'=20of=20null=20at=20ed=E2=80=A6=20(#2330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: https://github.com/facebook/draft-js/issues/2204 Pull Request resolved: https://github.com/facebook/draft-js/pull/2330 Reviewed By: claudiopro Differential Revision: D20582792 Pulled By: mrkev fbshipit-source-id: d96beaa1617ef82ba5663637f5daad254d9b17f7 --- src/component/handlers/edit/editOnInput.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/component/handlers/edit/editOnInput.js b/src/component/handlers/edit/editOnInput.js index 3cb49e7..6b0b5a9 100644 --- a/src/component/handlers/edit/editOnInput.js +++ b/src/component/handlers/edit/editOnInput.js @@ -69,8 +69,8 @@ function editOnInput(editor: DraftEditor, e: SyntheticInputEvent<>): void { const {anchorNode, isCollapsed} = domSelection; const isNotTextOrElementNode = - anchorNode.nodeType !== Node.TEXT_NODE && - anchorNode.nodeType !== Node.ELEMENT_NODE; + anchorNode?.nodeType !== Node.TEXT_NODE && + anchorNode?.nodeType !== Node.ELEMENT_NODE; if (isNotTextOrElementNode) { // TODO: (t16149272) figure out context for this change