mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
fix(composer): Pass in onFocus handler correctly to contenteditable
- Fixes issue where body lost focus when typing and focus switched to to field - Now passes the onFocus handler as part of a `ContenteditableExtension`
This commit is contained in:
parent
aa20212431
commit
8525717ff9
|
@ -301,15 +301,19 @@ class ComposerView extends React.Component
|
|||
<Contenteditable
|
||||
ref={Fields.Body}
|
||||
value={@_removeQuotedText(@state.body)}
|
||||
onFocus={ => @setState focusedField: Fields.Body}
|
||||
onChange={@_onChangeBody}
|
||||
onScrollTo={@props.onRequestScrollTo}
|
||||
onFilePaste={@_onFilePaste}
|
||||
onScrollToBottom={@_onScrollToBottom()}
|
||||
extensions={@state.composerExtensions}
|
||||
extensions={[@_contenteditableHandlers()].concat(@state.composerExtensions)}
|
||||
getComposerBoundingRect={@_getComposerBoundingRect}
|
||||
initialSelectionSnapshot={@_recoveredSelection} />
|
||||
|
||||
_contenteditableHandlers: =>
|
||||
{
|
||||
onFocus: => @setState(focusedField: Fields.Body)
|
||||
}
|
||||
|
||||
# The contenteditable decides when to request a scroll based on the
|
||||
# position of the cursor and its relative distance to this composer
|
||||
# component. We provide it our boundingClientRect so it can calculate
|
||||
|
|
|
@ -42,14 +42,7 @@ class Contenteditable extends React.Component
|
|||
# Passes an absolute top coordinate to scroll to.
|
||||
onScrollTo: React.PropTypes.func
|
||||
onScrollToBottom: React.PropTypes.func
|
||||
|
||||
# Extension DOM Mutating handlers. See {ContenteditableExtension}
|
||||
onFilePaste: React.PropTypes.func
|
||||
onInput: React.PropTypes.func
|
||||
onFocus: React.PropTypes.func
|
||||
onClick: React.PropTypes.func
|
||||
onKeyDown: React.PropTypes.func
|
||||
onShowContextMenu: React.PropTypes.func
|
||||
|
||||
# A list of objects that extend {ContenteditableExtension}
|
||||
extensions: React.PropTypes.array
|
||||
|
|
Loading…
Reference in a new issue