From d78db0169c0744cb8b765897ccb0a6fdd8ab342f Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 12 Jan 2016 19:09:57 -0800 Subject: [PATCH] fix(contenteditable): exportedSelection isn't always an inst of ExportedSelection This is a temporary fix that makes this function more robust to @innerState.exportedSelection not being an ExportedSelection instance. --- src/components/contenteditable/contenteditable.cjsx | 2 +- src/components/contenteditable/exported-selection.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/contenteditable/contenteditable.cjsx b/src/components/contenteditable/contenteditable.cjsx index 636eb2502..af726ca55 100644 --- a/src/components/contenteditable/contenteditable.cjsx +++ b/src/components/contenteditable/contenteditable.cjsx @@ -426,7 +426,7 @@ class Contenteditable extends React.Component # We also need to keep references to the previous selection state in # order for undo/redo to work properly. _saveExportedSelection: (exportedSelection) => - return if (@innerState.exportedSelection?.isEqual(exportedSelection)) + return if exportedSelection and exportedSelection.isEqual(@innerState.exportedSelection) @setInnerState exportedSelection: exportedSelection diff --git a/src/components/contenteditable/exported-selection.coffee b/src/components/contenteditable/exported-selection.coffee index d2d84b2ab..16650e538 100644 --- a/src/components/contenteditable/exported-selection.coffee +++ b/src/components/contenteditable/exported-selection.coffee @@ -35,7 +35,7 @@ class ExportedSelection and `endNodeIndex` fields via the `DOMUtils.getNodeIndex` method. ### isEqual: (otherSelection) -> - return false unless otherSelection? + return false unless otherSelection return false if @type isnt otherSelection.type return true if @type is 'None' and otherSelection.type is 'None'