Browse Source

fix reply bar and update repo name

dev
xmcp 6 years ago
parent
commit
016d3b7bd1
  1. 17
      src/Config.js
  2. 2
      src/Flows.js
  3. 2
      src/Title.js

17
src/Config.js

@ -20,19 +20,20 @@ const DEFAULT_CONFIG={
}; };
export function load_config() { export function load_config() {
let config_txt=localStorage['hole_config']||'{}'; let config=Object.assign({},DEFAULT_CONFIG);
let config; let loaded_config;
try { try {
config=JSON.parse(config_txt); loaded_config=JSON.parse(localStorage['hole_config']||'{}');
} catch(e) { } catch(e) {
alert('设置加载失败,将重置为默认设置!\n'+e); alert('设置加载失败,将重置为默认设置!\n'+e);
delete localStorage['hole_config']; delete localStorage['hole_config'];
config={}; loaded_config={};
} }
Object.keys(DEFAULT_CONFIG).forEach((key)=>{ // unrecognized configs are removed
if(config[key]===undefined) Object.keys(loaded_config).forEach((key)=>{
config[key]=DEFAULT_CONFIG[key]; if(config[key]!==undefined)
config[key]=loaded_config[key];
}); });
console.log('config loaded',config); console.log('config loaded',config);
@ -208,7 +209,7 @@ export class ConfigUI extends PureComponent {
<hr /> <hr />
<p> <p>
新功能建议或问题反馈请在&nbsp; 新功能建议或问题反馈请在&nbsp;
<a href="https://github.com/xmcp/ashole/issues" target="_blank">GitHub <span className="icon icon-github" /></a> <a href="https://github.com/pkuhelper-web/webhole/issues" target="_blank">GitHub <span className="icon icon-github" /></a>
&nbsp;提出 &nbsp;提出
</p> </p>
</div> </div>

2
src/Flows.js

@ -283,7 +283,7 @@ class FlowSidebar extends PureComponent {
show_reply_bar(name,event) { show_reply_bar(name,event) {
if(this.reply_ref.current && !event.target.closest('a')) { if(this.reply_ref.current && !event.target.closest('a')) {
let text=this.reply_ref.current.get(); let text=this.reply_ref.current.get();
if(/^\s*(Re (洞主|\b[A-Z][a-z]+){0,2}:)?\s*$/.test(text)) {// text is nearly empty so we can replace it 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+': '; 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('');

2
src/Title.js

@ -125,7 +125,7 @@ class ControlBar extends PureComponent {
&nbsp;/&nbsp; &nbsp;/&nbsp;
<a href="http://pkuhelper.pku.edu.cn/treehole_rules.html" target="_blank">树洞规范</a> <a href="http://pkuhelper.pku.edu.cn/treehole_rules.html" target="_blank">树洞规范</a>
&nbsp;/&nbsp; &nbsp;/&nbsp;
<a href="https://github.com/xmcp/ashole/issues" target="_blank">意见反馈 <span className="icon icon-github" /></a> <a href="https://github.com/pkuhelper-web/webhole/issues" target="_blank">意见反馈 <span className="icon icon-github" /></a>
</div> </div>
{HELP_TEXT} {HELP_TEXT}
</div> </div>

Loading…
Cancel
Save