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.
This commit is contained in:
Ben Gotow 2016-01-12 19:09:57 -08:00
parent e8997b0944
commit d78db0169c
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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'