mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-04 07:10:06 +08:00
fix(messages): fix jumping message list on draft focus
We were erroneously jumping to an individual message when you focused on it.
This commit is contained in:
parent
d80edbf7f3
commit
60f7290564
2 changed files with 12 additions and 9 deletions
|
@ -272,7 +272,7 @@ class ComposerEditor extends Component {
|
||||||
value={this.props.body}
|
value={this.props.body}
|
||||||
onChange={this.props.onBodyChanged}
|
onChange={this.props.onBodyChanged}
|
||||||
onFilePaste={this.props.onFilePaste}
|
onFilePaste={this.props.onFilePaste}
|
||||||
onSelectionChanged={this._ensureSelectionVisible}
|
onSelectionRestored={this._ensureSelectionVisible}
|
||||||
initialSelectionSnapshot={this.props.initialSelectionSnapshot}
|
initialSelectionSnapshot={this.props.initialSelectionSnapshot}
|
||||||
extensions={[this._coreExtension].concat(this.state.extensions)} />
|
extensions={[this._coreExtension].concat(this.state.extensions)} />
|
||||||
);
|
);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Contenteditable extends React.Component
|
||||||
extensions: []
|
extensions: []
|
||||||
spellcheck: true
|
spellcheck: true
|
||||||
floatingToolbar: true
|
floatingToolbar: true
|
||||||
onSelectionChanged: =>
|
onSelectionRestored: =>
|
||||||
|
|
||||||
coreServices: [MouseService, ClipboardService]
|
coreServices: [MouseService, ClipboardService]
|
||||||
|
|
||||||
|
@ -153,7 +153,9 @@ class Contenteditable extends React.Component
|
||||||
previousExportedSelection: @innerState.exportedSelection
|
previousExportedSelection: @innerState.exportedSelection
|
||||||
|
|
||||||
componentDidUpdate: =>
|
componentDidUpdate: =>
|
||||||
@_restoreSelection() if @_shouldRestoreSelectionOnUpdate()
|
if @_shouldRestoreSelectionOnUpdate()
|
||||||
|
@_restoreSelection()
|
||||||
|
@_notifyOfSelectionRestoration()
|
||||||
@_refreshServices()
|
@_refreshServices()
|
||||||
@_mutationObserver.disconnect()
|
@_mutationObserver.disconnect()
|
||||||
@_mutationObserver.observe(@_editableNode(), @_mutationConfig())
|
@_mutationObserver.observe(@_editableNode(), @_mutationConfig())
|
||||||
|
@ -533,9 +535,15 @@ class Contenteditable extends React.Component
|
||||||
selection = new ExtendedSelection(@_editableNode())
|
selection = new ExtendedSelection(@_editableNode())
|
||||||
selection.importSelection(@innerState.exportedSelection)
|
selection.importSelection(@innerState.exportedSelection)
|
||||||
if selection.isInScope()
|
if selection.isInScope()
|
||||||
@_onSelectionChanged(selection)
|
# The bounding client rect has changed
|
||||||
|
@setInnerState editableNode: @_editableNode()
|
||||||
@_setupNonMutationListeners()
|
@_setupNonMutationListeners()
|
||||||
|
|
||||||
|
_notifyOfSelectionRestoration: =>
|
||||||
|
selection = new ExtendedSelection(@_editableNode())
|
||||||
|
if selection.isInScope()
|
||||||
|
@props.onSelectionRestored(selection, @_editableNode())
|
||||||
|
|
||||||
# When the component updates, the selection may have changed from our
|
# When the component updates, the selection may have changed from our
|
||||||
# last known saved position. This can happen for a couple of reasons:
|
# last known saved position. This can happen for a couple of reasons:
|
||||||
#
|
#
|
||||||
|
@ -547,9 +555,4 @@ class Contenteditable extends React.Component
|
||||||
(document.activeElement is @_editableNode() or
|
(document.activeElement is @_editableNode() or
|
||||||
not @_editableNode().parentNode.contains(document.activeElement))
|
not @_editableNode().parentNode.contains(document.activeElement))
|
||||||
|
|
||||||
_onSelectionChanged: (selection) ->
|
|
||||||
@props.onSelectionChanged(selection, @_editableNode())
|
|
||||||
# The bounding client rect has changed
|
|
||||||
@setInnerState editableNode: @_editableNode()
|
|
||||||
|
|
||||||
module.exports = Contenteditable
|
module.exports = Contenteditable
|
||||||
|
|
Loading…
Reference in a new issue