mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-12 22:28:32 +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
|
# We also need to keep references to the previous selection state in
|
||||||
# order for undo/redo to work properly.
|
# order for undo/redo to work properly.
|
||||||
_saveExportedSelection: (exportedSelection) =>
|
_saveExportedSelection: (exportedSelection) =>
|
||||||
return if (@innerState.exportedSelection?.isEqual(exportedSelection))
|
return if exportedSelection and exportedSelection.isEqual(@innerState.exportedSelection)
|
||||||
|
|
||||||
@setInnerState
|
@setInnerState
|
||||||
exportedSelection: exportedSelection
|
exportedSelection: exportedSelection
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ExportedSelection
|
||||||
and `endNodeIndex` fields via the `DOMUtils.getNodeIndex` method.
|
and `endNodeIndex` fields via the `DOMUtils.getNodeIndex` method.
|
||||||
###
|
###
|
||||||
isEqual: (otherSelection) ->
|
isEqual: (otherSelection) ->
|
||||||
return false unless otherSelection?
|
return false unless otherSelection
|
||||||
return false if @type isnt otherSelection.type
|
return false if @type isnt otherSelection.type
|
||||||
|
|
||||||
return true if @type is 'None' and otherSelection.type is 'None'
|
return true if @type is 'None' and otherSelection.type is 'None'
|
||||||
|
|
Loading…
Add table
Reference in a new issue