#{this.props.info.cid}
+ {this.props.do_filter_name ?
+ {this.props.do_filter_name(this.props.info.name);}}>
+ #{this.props.info.cid}
+ :
+ #{this.props.info.cid}
+ }
{this.props.info.tag!==null &&
@@ -191,24 +197,14 @@ class FlowSidebar extends PureComponent {
replies: props.replies,
loading_status: 'done',
error_msg: null,
- dz_only: false,
+ filter_name: null,
+ rev: false,
};
this.color_picker=props.color_picker;
this.syncState=props.sync_state||(()=>{});
this.reply_ref=React.createRef();
}
- /*componentWillReceiveProps(nextProps) {
- this.setState({
- attention: nextProps.attention,
- info: nextProps.info,
- replies: nextProps.replies,
- loading_status: 'done',
- });
- this.color_picker=nextProps.color_picker;
- this.syncState=nextProps.sync_state||(()=>{});
- }*/ // refactored to use key instead
-
set_variant(cid,variant) {
this.setState((prev)=>{
if(cid)
@@ -305,14 +301,20 @@ class FlowSidebar extends PureComponent {
}
}
- toggle_dz_only() {
+ set_filter_name(name) {
+ this.setState((prevState)=>({
+ filter_name: name===prevState.filter_name ? null : name,
+ }));
+ }
+
+ toggle_rev() {
this.setState((prevState)=>({
- dz_only: !prevState.dz_only,
+ rev: !prevState.rev,
}));
}
show_reply_bar(name,event) {
- if(this.reply_ref.current && !event.target.closest('a')) {
+ if(this.reply_ref.current && !event.target.closest('a, .clickable')) {
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
let should_text='Re '+name+': ';
@@ -330,29 +332,39 @@ class FlowSidebar extends PureComponent {
let show_pid=load_single_meta(this.props.show_sidebar,this.props.token,this.props.parents.concat([this.state.info.pid]));
- let replies_to_show=this.state.dz_only ? this.state.replies.filter((r)=>r.islz) : this.state.replies;
+ let replies_to_show=this.state.filter_name ? this.state.replies.filter((r)=>r.name===this.state.filter_name) : this.state.replies.slice();
+ if(this.state.rev) replies_to_show.reverse();
+
+ // key for lazyload elem
+ let view_mode_key=(this.state.rev ? 'y-' : 'n-')+(this.state.filter_name||'null');
return (
+ {this.set_filter_name(null)}}>还原
+ 当前只看
+
您已登录。
-
+
diff --git a/src/index.css b/src/index.css index ffdd16c..2e26d85 100644 --- a/src/index.css +++ b/src/index.css @@ -27,6 +27,7 @@ input, textarea { border-radius: 5px; border: 1px solid black; outline: none; + margin: 0; } input { padding: 0 1em;