]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix text being incorrectly pre-selected in composer textarea on /share
authorClaire <claire.github-309c@sitedethib.com>
Sun, 23 Jan 2022 17:24:34 +0000 (18:24 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Sun, 23 Jan 2022 17:24:34 +0000 (18:24 +0100)
Port 3a103cd317fd56aca27fca01e03647df44e3ffd2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/compose/components/compose_form.js
app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js

index d4804a3c286be648665a0a3343f69fcdd9be4065..5dfc119c1b94d1c26b72aae12565e86ada21bb7a 100644 (file)
@@ -58,6 +58,7 @@ class ComposeForm extends ImmutablePureComponent {
     onPickEmoji: PropTypes.func,
     showSearch: PropTypes.bool,
     anyMedia: PropTypes.bool,
+    isInReply: PropTypes.bool,
     singleColumn: PropTypes.bool,
 
     advancedOptions: ImmutablePropTypes.map,
@@ -233,7 +234,7 @@ class ComposeForm extends ImmutablePureComponent {
     //  Caret/selection handling.
     if (focusDate !== prevProps.focusDate) {
       switch (true) {
-      case preselectDate !== prevProps.preselectDate && preselectOnReply:
+      case preselectDate !== prevProps.preselectDate && this.props.isInReply && preselectOnReply:
         selectionStart = text.search(/\s/) + 1;
         selectionEnd = text.length;
         break;
index fcd2caf1bfa434ad610dd509926383c827b9d38e..8eff8a36b8a5e42507eff3d60bf172cd6e8c2c91 100644 (file)
@@ -68,6 +68,7 @@ function mapStateToProps (state) {
     spoilersAlwaysOn: spoilersAlwaysOn,
     mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']),
     preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']),
+    isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
   };
 };