mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 改进网络图片转换本地图片消息提示 https://github.com/siyuan-note/siyuan/issues/5131
This commit is contained in:
parent
bb669e47f6
commit
101a8e7350
5 changed files with 9 additions and 8 deletions
|
|
@ -69,7 +69,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
|
|||
}
|
||||
|
||||
var files int
|
||||
util.PushMsg(Conf.Language(119), 7000)
|
||||
msgId := gulu.Rand.String(7)
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
|
|
@ -90,6 +90,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
|
|||
u = strings.Replace(u, "/0?", "/640?", 1)
|
||||
}
|
||||
}
|
||||
util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(119), u), 15000)
|
||||
request := util.NewBrowserRequest(Conf.System.NetworkProxy.String())
|
||||
resp, reqErr := request.Get(u)
|
||||
if nil != reqErr {
|
||||
|
|
@ -147,14 +148,14 @@ func NetImg2LocalAssets(rootID string) (err error) {
|
|||
return ast.WalkContinue
|
||||
})
|
||||
if 0 < files {
|
||||
util.PushMsg(Conf.Language(113), 7000)
|
||||
util.PushUpdateMsg(msgId, Conf.Language(113), 7000)
|
||||
if err = writeJSONQueue(tree); nil != err {
|
||||
return
|
||||
}
|
||||
sql.WaitForWritingDatabase()
|
||||
util.PushMsg(fmt.Sprintf(Conf.Language(120), files), 5000)
|
||||
util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(120), files), 5000)
|
||||
} else {
|
||||
util.PushMsg(Conf.Language(121), 3000)
|
||||
util.PushUpdateMsg(msgId, Conf.Language(121), 3000)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue