mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 15:46:28 +08:00
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:
parent
e8997b0944
commit
d78db0169c
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue