Restore preselect on reply option

pull/2644/head
Claire 2024-02-23 01:40:12 +01:00
parent 84d05ca221
commit 23dc650596
2 changed files with 3 additions and 1 deletions

View File

@ -58,6 +58,7 @@ class ComposeForm extends ImmutablePureComponent {
focusDate: PropTypes.instanceOf(Date), focusDate: PropTypes.instanceOf(Date),
caretPosition: PropTypes.number, caretPosition: PropTypes.number,
preselectDate: PropTypes.instanceOf(Date), preselectDate: PropTypes.instanceOf(Date),
preselectOnReply: PropTypes.bool,
isSubmitting: PropTypes.bool, isSubmitting: PropTypes.bool,
isChangingUpload: PropTypes.bool, isChangingUpload: PropTypes.bool,
isEditing: PropTypes.bool, isEditing: PropTypes.bool,
@ -191,7 +192,7 @@ class ComposeForm extends ImmutablePureComponent {
if (this.props.focusDate && this.props.focusDate !== prevProps.focusDate) { if (this.props.focusDate && this.props.focusDate !== prevProps.focusDate) {
let selectionEnd, selectionStart; let selectionEnd, selectionStart;
if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply) { if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply && this.props.preselectOnReply) {
selectionEnd = this.props.text.length; selectionEnd = this.props.text.length;
selectionStart = this.props.text.search(/\s/) + 1; selectionStart = this.props.text.search(/\s/) + 1;
} else if (typeof this.props.caretPosition === 'number') { } else if (typeof this.props.caretPosition === 'number') {

View File

@ -41,6 +41,7 @@ const mapStateToProps = state => ({
focusDate: state.getIn(['compose', 'focusDate']), focusDate: state.getIn(['compose', 'focusDate']),
caretPosition: state.getIn(['compose', 'caretPosition']), caretPosition: state.getIn(['compose', 'caretPosition']),
preselectDate: state.getIn(['compose', 'preselectDate']), preselectDate: state.getIn(['compose', 'preselectDate']),
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']),
isSubmitting: state.getIn(['compose', 'is_submitting']), isSubmitting: state.getIn(['compose', 'is_submitting']),
isEditing: state.getIn(['compose', 'id']) !== null, isEditing: state.getIn(['compose', 'id']) !== null,
isChangingUpload: state.getIn(['compose', 'is_changing_upload']), isChangingUpload: state.getIn(['compose', 'is_changing_upload']),