diff options
author | pluralcafe-docker <git@plural.cafe> | 2018-10-01 05:42:11 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2018-10-01 05:42:11 +0000 |
commit | f9275cb762a311cbf298b3929552a153703c0726 (patch) | |
tree | 35797a6c1ae1c51d5e42ffe8b63eecbfb4336f56 /app/javascript/flavours/glitch/features/composer | |
parent | 2aedb7e83cf7a2c1a7de69d2bc20808f20c10f8f (diff) | |
parent | 4e60a0d5433f5dfa4f71a452cc5c6ceb0f21ceab (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer')
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/index.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 77f9ee0c1..257797047 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -102,6 +102,7 @@ function mapStateToProps (state) { anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, spoilersAlwaysOn: spoilersAlwaysOn, mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), + preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']), }; }; @@ -146,7 +147,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onMount() { dispatch(mountCompose()); }, - onOpenActionModal(props) { + onOpenActionsModal(props) { dispatch(openModal('ACTIONS', props)); }, onOpenDoodleModal() { @@ -242,7 +243,7 @@ const handlers = { } // Submit disabled: - if (isSubmitting || isUploading || (!!text.length && !text.trim().length && !anyMedia)) { + if (isSubmitting || isUploading || (!text.trim().length && !anyMedia)) { return; } @@ -328,13 +329,14 @@ class Composer extends React.Component { isSubmitting, preselectDate, text, + preselectOnReply, } = this.props; let selectionEnd, selectionStart; // Caret/selection handling. if (focusDate !== prevProps.focusDate) { switch (true) { - case preselectDate !== prevProps.preselectDate: + case preselectDate !== prevProps.preselectDate && preselectOnReply: selectionStart = text.search(/\s/) + 1; selectionEnd = text.length; break; @@ -347,6 +349,7 @@ class Composer extends React.Component { if (textarea) { textarea.setSelectionRange(selectionStart, selectionEnd); textarea.focus(); + textarea.scrollIntoView(); } // Refocuses the textarea after submitting. @@ -415,7 +418,7 @@ class Composer extends React.Component { spoilersAlwaysOn, } = this.props; - let disabledButton = isSubmitting || isUploading || (!!text.length && !text.trim().length && !anyMedia); + let disabledButton = isSubmitting || isUploading || (!text.trim().length && !anyMedia); return ( <div className='composer'> @@ -533,6 +536,7 @@ Composer.propTypes = { anyMedia: PropTypes.bool, spoilersAlwaysOn: PropTypes.bool, mediaDescriptionConfirmation: PropTypes.bool, + preselectOnReply: PropTypes.bool, // Dispatch props. onCancelReply: PropTypes.func, |