@@ -16,7 +16,6 @@ import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
16
16
import PollFormContainer from '../containers/poll_form_container' ;
17
17
import UploadFormContainer from '../containers/upload_form_container' ;
18
18
import WarningContainer from '../containers/warning_container' ;
19
- import { isMobile } from '../../../is_mobile' ;
20
19
import ImmutablePureComponent from 'react-immutable-pure-component' ;
21
20
import { length } from 'stringz' ;
22
21
import { countableText } from '../util/counter' ;
@@ -60,13 +59,13 @@ class ComposeForm extends ImmutablePureComponent {
60
59
onChangeSpoilerText : PropTypes . func . isRequired ,
61
60
onPaste : PropTypes . func . isRequired ,
62
61
onPickEmoji : PropTypes . func . isRequired ,
63
- showSearch : PropTypes . bool ,
62
+ autoFocus : PropTypes . bool ,
64
63
anyMedia : PropTypes . bool ,
65
64
singleColumn : PropTypes . bool ,
66
65
} ;
67
66
68
67
static defaultProps = {
69
- showSearch : false ,
68
+ autoFocus : false ,
70
69
} ;
71
70
72
71
handleChange = ( e ) => {
@@ -148,7 +147,7 @@ class ComposeForm extends ImmutablePureComponent {
148
147
// - Replying to zero or one users, places the cursor at the end of the textbox.
149
148
// - Replying to more than one user, selects any usernames past the first;
150
149
// this provides a convenient shortcut to drop everyone else from the conversation.
151
- if ( this . props . focusDate !== prevProps . focusDate ) {
150
+ if ( this . props . focusDate && this . props . focusDate !== prevProps . focusDate ) {
152
151
let selectionEnd , selectionStart ;
153
152
154
153
if ( this . props . preselectDate !== prevProps . preselectDate ) {
@@ -169,7 +168,7 @@ class ComposeForm extends ImmutablePureComponent {
169
168
} else if ( this . props . spoiler !== prevProps . spoiler ) {
170
169
if ( this . props . spoiler ) {
171
170
this . spoilerText . input . focus ( ) ;
172
- } else {
171
+ } else if ( prevProps . spoiler ) {
173
172
this . autosuggestTextarea . textarea . focus ( ) ;
174
173
}
175
174
}
@@ -196,7 +195,7 @@ class ComposeForm extends ImmutablePureComponent {
196
195
}
197
196
198
197
render ( ) {
199
- const { intl, onPaste, showSearch } = this . props ;
198
+ const { intl, onPaste, autoFocus } = this . props ;
200
199
const disabled = this . props . isSubmitting ;
201
200
let publishText = '' ;
202
201
@@ -243,7 +242,7 @@ class ComposeForm extends ImmutablePureComponent {
243
242
onSuggestionsClearRequested = { this . onSuggestionsClearRequested }
244
243
onSuggestionSelected = { this . onSuggestionSelected }
245
244
onPaste = { onPaste }
246
- autoFocus = { ! showSearch && ! isMobile ( window . innerWidth ) }
245
+ autoFocus = { autoFocus }
247
246
>
248
247
< EmojiPickerDropdown onPickEmoji = { this . handleEmojiPick } />
249
248
< div className = 'compose-form__modifiers' >
0 commit comments