fix: tag save blocks browser — capture 'this' before fetch (then callback 'this' is window, causing infinite loop)
This commit is contained in:
parent
26c8d6b77a
commit
000b3c0b10
@ -128,8 +128,9 @@ submit_js = ("var rows=document.querySelectorAll('#tag_list_panel [data-sel]');"
|
||||
"var ids=[];rows.forEach(function(r){if(r.getAttribute('data-sel')==='1'){ids.push(r.id.replace('tagrow_',''))}});"
|
||||
"if(ids.length===0){alert('请至少勾选一个标签');return};"
|
||||
"var u='/rag/knowledge_bases_list/save_tags.dspy?_webbricks_=1&kb_id=" + kb_id + "&media_id=" + doc_id + "&tag_ids='+encodeURIComponent(ids.join(','));"
|
||||
"var self=this;"
|
||||
"fetch(u).then(function(r){return r.json()}).then(function(d){"
|
||||
"var pw=null;var w=this;while(w){if(w instanceof bricks.PopupWindow||w instanceof bricks.Popup){pw=w;break};w=w.parent};"
|
||||
"var pw=null;var w=self;while(w){if(w instanceof bricks.PopupWindow||w instanceof bricks.Popup){pw=w;break};w=w.parent};"
|
||||
"if(pw){pw.dismiss();pw.destroy()};"
|
||||
"location.reload();"
|
||||
"}).catch(function(){alert('网络错误')});")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user