Browse Source

fix bugs

master
hole-thu 2 years ago
parent
commit
4aa09c2cc3
  1. 8
      src/Common.js
  2. 4
      src/Flows.js
  3. 2
      src/UserAction.js

8
src/Common.js

@ -360,15 +360,17 @@ export class SafeTextarea extends Component {
); );
} }
set(text) { set(text, keep_pos = false) {
this.change_callback(text); 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( this.setState(
{ {
text: text, text: text,
}, },
() => { () => {
this.area_ref.current.setSelectionRange(currPos, currPos); if (keep_pos)
this.area_ref.current.setSelectionRange(currPosStart, currPosEnd);
this.area_ref.current.focus(); this.area_ref.current.focus();
}, },
); );

4
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) { 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 = ( let res = (
<div <div

2
src/UserAction.js

@ -691,7 +691,7 @@ export class PostForm extends Component {
'\n' + '\n' +
(file_type.startsWith('image/') ? `![](${url})` : url); (file_type.startsWith('image/') ? `![](${url})` : url);
this.setState({ text: new_text }); this.setState({ text: new_text });
this.area_ref.current.set(new_text); this.area_ref.current.set(new_text, true);
} }
upload_progress(event) { upload_progress(event) {

Loading…
Cancel
Save