Browse Source

保存折叠和是否允许搜索草稿

pull/6/head
hole-thu 4 years ago
parent
commit
a4716de4f5
  1. 11
      src/UserAction.js
  2. 2
      src/infrastructure/widgets.js

11
src/UserAction.js

@ -362,8 +362,8 @@ export class PostForm extends Component {
super(props);
this.state = {
text: '',
cw: '',
allow_search: false,
cw: window.CW_BACKUP || '',
allow_search: window.AS_BACKUP || false,
loading_status: 'done',
img_tip: null,
preview: false,
@ -381,6 +381,11 @@ export class PostForm extends Component {
if (this.area_ref.current) this.area_ref.current.focus();
}
componentWillUnmount() {
window.CW_BACKUP = this.state.cw;
window.AS_BACKUP = this.state.allow_search;
}
on_allow_search_change(event) {
this.setState({
allow_search: event.target.checked,
@ -429,6 +434,7 @@ export class PostForm extends Component {
});
this.area_ref.current.clear();
this.props.on_complete();
window.CW_BACKUP = '';
})
.catch((e) => {
console.error(e);
@ -644,6 +650,7 @@ export class PostForm extends Component {
<input
type="checkbox"
onChange={this.on_allow_search_change_bound}
checked={this.state.allow_search}
/>
允许被搜索
</label>

2
src/infrastructure/widgets.js

@ -64,7 +64,7 @@ class LoginPopupSelf extends Component {
e.preventDefault();
tar.href = '/_login?p=thuhole&token=' + ref.current.value;
console.log(tar);
alert('应T大树洞管理员要求,已停止T大树洞token登陆');
alert('T大树洞已经没有啦😭');
}
render() {

Loading…
Cancel
Save