diff --git a/src/Common.js b/src/Common.js index 3e5d37e..78850a4 100644 --- a/src/Common.js +++ b/src/Common.js @@ -360,15 +360,17 @@ export class SafeTextarea extends Component { ); } - set(text) { + set(text, keep_pos = false) { this.change_callback(text); - let currPos = this.area_ref.current.selectionStart; + let currPosStart = this.area_ref.current.selectionStart; + let currPosEnd = this.area_ref.current.selectionEnd; this.setState( { text: text, }, () => { - this.area_ref.current.setSelectionRange(currPos, currPos); + if (keep_pos) + this.area_ref.current.setSelectionRange(currPosStart, currPosEnd); this.area_ref.current.focus(); }, ); diff --git a/src/Flows.js b/src/Flows.js index 5004f48..02d3e44 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -1109,10 +1109,10 @@ class FlowItemRow extends PureComponent { } } - let replies_to_show = this.state.replies.slice(0, PREVIEW_REPLY_COUNT); if (mode === 'list' && submode === 1) { - replies_to_show.reverse(); + this.state.replies.reverse(); } + let replies_to_show = this.state.replies.slice(0, PREVIEW_REPLY_COUNT); let res = (