diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-01-20 20:56:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 20:56:21 +0100 |
commit | 3a103cd317fd56aca27fca01e03647df44e3ffd2 (patch) | |
tree | 2942406dac2d079bb708fc11dde4569e93c9e48b /app | |
parent | 1e8c885e5a5a3456785578440168983ce21266ab (diff) |
Fix text being incorrectly pre-selected in composer textarea on /share (#17339)
Fixes #17295
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/mastodon/features/compose/components/compose_form.js | 3 | ||||
-rw-r--r-- | app/javascript/mastodon/features/compose/containers/compose_form_container.js | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index ba2d20cc7..d224222ac 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -60,6 +60,7 @@ class ComposeForm extends ImmutablePureComponent { onPickEmoji: PropTypes.func.isRequired, showSearch: PropTypes.bool, anyMedia: PropTypes.bool, + isInReply: PropTypes.bool, singleColumn: PropTypes.bool, }; @@ -149,7 +150,7 @@ class ComposeForm extends ImmutablePureComponent { if (this.props.focusDate !== prevProps.focusDate) { let selectionEnd, selectionStart; - if (this.props.preselectDate !== prevProps.preselectDate) { + if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply) { selectionEnd = this.props.text.length; selectionStart = this.props.text.search(/\s/) + 1; } else if (typeof this.props.caretPosition === 'number') { diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js index 37a0e8845..c44850294 100644 --- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js +++ b/app/javascript/mastodon/features/compose/containers/compose_form_container.js @@ -25,6 +25,7 @@ const mapStateToProps = state => ({ isUploading: state.getIn(['compose', 'is_uploading']), showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, + isInReply: state.getIn(['compose', 'in_reply_to']) !== null, }); const mapDispatchToProps = (dispatch) => ({ |