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

2
src/infrastructure/widgets.js

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

Loading…
Cancel
Save