fix reply bar and update repo name
This commit is contained in:
@@ -20,19 +20,20 @@ const DEFAULT_CONFIG={
|
||||
};
|
||||
|
||||
export function load_config() {
|
||||
let config_txt=localStorage['hole_config']||'{}';
|
||||
let config;
|
||||
let config=Object.assign({},DEFAULT_CONFIG);
|
||||
let loaded_config;
|
||||
try {
|
||||
config=JSON.parse(config_txt);
|
||||
loaded_config=JSON.parse(localStorage['hole_config']||'{}');
|
||||
} catch(e) {
|
||||
alert('设置加载失败,将重置为默认设置!\n'+e);
|
||||
delete localStorage['hole_config'];
|
||||
config={};
|
||||
loaded_config={};
|
||||
}
|
||||
|
||||
Object.keys(DEFAULT_CONFIG).forEach((key)=>{
|
||||
if(config[key]===undefined)
|
||||
config[key]=DEFAULT_CONFIG[key];
|
||||
// unrecognized configs are removed
|
||||
Object.keys(loaded_config).forEach((key)=>{
|
||||
if(config[key]!==undefined)
|
||||
config[key]=loaded_config[key];
|
||||
});
|
||||
|
||||
console.log('config loaded',config);
|
||||
@@ -208,7 +209,7 @@ export class ConfigUI extends PureComponent {
|
||||
<hr />
|
||||
<p>
|
||||
新功能建议或问题反馈请在
|
||||
<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>
|
||||
提出。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -283,7 +283,7 @@ class FlowSidebar extends PureComponent {
|
||||
show_reply_bar(name,event) {
|
||||
if(this.reply_ref.current && !event.target.closest('a')) {
|
||||
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+': ';
|
||||
if(should_text===this.reply_ref.current.get())
|
||||
this.reply_ref.current.set('');
|
||||
|
||||
@@ -125,7 +125,7 @@ class ControlBar extends PureComponent {
|
||||
/
|
||||
<a href="http://pkuhelper.pku.edu.cn/treehole_rules.html" target="_blank">树洞规范</a>
|
||||
/
|
||||
<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>
|
||||
{HELP_TEXT}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user