forked from newthuhole/hole_thu_frontend
fix reply bar bug
This commit is contained in:
@@ -64,13 +64,14 @@ export class SafeTextarea extends Component {
|
|||||||
this.clear=this.clear.bind(this);
|
this.clear=this.clear.bind(this);
|
||||||
this.area_ref=React.createRef();
|
this.area_ref=React.createRef();
|
||||||
this.change_callback=props.on_change||(()=>{});
|
this.change_callback=props.on_change||(()=>{});
|
||||||
this.change_callback(this.state.text);
|
|
||||||
this.submit_callback=props.on_submit||(()=>{});
|
this.submit_callback=props.on_submit||(()=>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setState({
|
this.setState({
|
||||||
text: window.TEXTAREA_BACKUP[this.props.id]||''
|
text: window.TEXTAREA_BACKUP[this.props.id]||''
|
||||||
|
},()=>{
|
||||||
|
this.change_callback(this.state.text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ class FlowSidebar extends PureComponent {
|
|||||||
show_reply_bar(name,event) {
|
show_reply_bar(name,event) {
|
||||||
if(this.reply_ref.current && !event.target.closest('a, .clickable')) {
|
if(this.reply_ref.current && !event.target.closest('a, .clickable')) {
|
||||||
let text=this.reply_ref.current.get();
|
let text=this.reply_ref.current.get();
|
||||||
if(/^\s*(?:Re (?:|洞主|(?:[A-Z][a-z]+ )?(?:[A-Z][a-z]+)):)?\s*$/.test(text)) {// text is nearly empty so we can replace it
|
if(/^\s*(?:Re (?:|洞主|(?:[A-Z][a-z]+ )?(?:[A-Z][a-z]+)|You Win(?: \d+)?):)?\s*$/.test(text)) {// text is nearly empty so we can replace it
|
||||||
let should_text='Re '+name+': ';
|
let should_text='Re '+name+': ';
|
||||||
if(should_text===this.reply_ref.current.get())
|
if(should_text===this.reply_ref.current.get())
|
||||||
this.reply_ref.current.set('');
|
this.reply_ref.current.set('');
|
||||||
|
|||||||
Reference in New Issue
Block a user