🎨 改进网络图片转换本地图片消息提示 https://github.com/siyuan-note/siyuan/issues/5131

This commit is contained in:
Liang Ding 2022-06-09 19:17:15 +08:00
parent bb669e47f6
commit 101a8e7350
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
5 changed files with 9 additions and 8 deletions

View File

@ -850,7 +850,7 @@
"116": "Processing, please wait...", "116": "Processing, please wait...",
"117": "[%s] is not a valid Pandoc executable", "117": "[%s] is not a valid Pandoc executable",
"118": "The current settings do not allow the creation of sub-documents under a document 7 levels deep", "118": "The current settings do not allow the creation of sub-documents under a document 7 levels deep",
"119": "Downloading web image...", "119": "Downloading web image [%s]",
"120": "Download complete, [%d] files total", "120": "Download complete, [%d] files total",
"121": "There is no network image in this document", "121": "There is no network image in this document",
"122": "This function needs to be configured on SiYuan desktop", "122": "This function needs to be configured on SiYuan desktop",

View File

@ -850,7 +850,7 @@
"116": "Traitement en cours, veuillez patienter...", "116": "Traitement en cours, veuillez patienter...",
"117": "[%s] n'est pas un exécutable Pandoc valide", "117": "[%s] n'est pas un exécutable Pandoc valide",
"118": "Les paramètres actuels ne permettent pas la création de sous-documents sous un document de 7 niveaux de profondeur", "118": "Les paramètres actuels ne permettent pas la création de sous-documents sous un document de 7 niveaux de profondeur",
"119": "Téléchargement de l'image Web...", "119": "Téléchargement de l'image Web [%s]",
"120": "Téléchargement terminé, [%d] fichiers au total", "120": "Téléchargement terminé, [%d] fichiers au total",
"121": "Il n'y a pas d'image réseau dans ce document", "121": "Il n'y a pas d'image réseau dans ce document",
"122": "Cette fonction doit être configurée sur le bureau SiYuan", "122": "Cette fonction doit être configurée sur le bureau SiYuan",

View File

@ -850,7 +850,7 @@
"116": "正在處理中,請稍等...", "116": "正在處理中,請稍等...",
"117": "[%s] 不是有效的 Pandoc 可執行文件", "117": "[%s] 不是有效的 Pandoc 可執行文件",
"118": "當前設置不允許在 7 層深度的文檔下創建子文檔", "118": "當前設置不允許在 7 層深度的文檔下創建子文檔",
"119": "正在下載網絡圖片...", "119": "正在下載網絡圖片 [%s]",
"120": "下載完畢,一共 [%d] 個文件", "120": "下載完畢,一共 [%d] 個文件",
"122": "該功能需在思源桌面端進行配置", "122": "該功能需在思源桌面端進行配置",
"123": "新增/選擇雲端同步目錄後才能啟用同步功能", "123": "新增/選擇雲端同步目錄後才能啟用同步功能",

View File

@ -851,7 +851,7 @@
"116": "正在处理中,请稍等...", "116": "正在处理中,请稍等...",
"117": "[%s] 不是有效的 Pandoc 可执行文件", "117": "[%s] 不是有效的 Pandoc 可执行文件",
"118": "当前设置不允许在 7 层深度的文档下创建子文档", "118": "当前设置不允许在 7 层深度的文档下创建子文档",
"119": "正在下载网络图片...", "119": "正在下载网络图片 [%s]",
"120": "下载完毕,一共 [%d] 个文件", "120": "下载完毕,一共 [%d] 个文件",
"121": "该文档中不存在网络图片", "121": "该文档中不存在网络图片",
"122": "该功能需在思源桌面端进行配置", "122": "该功能需在思源桌面端进行配置",

View File

@ -69,7 +69,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
} }
var files int 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 { ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering { if !entering {
return ast.WalkContinue return ast.WalkContinue
@ -90,6 +90,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
u = strings.Replace(u, "/0?", "/640?", 1) u = strings.Replace(u, "/0?", "/640?", 1)
} }
} }
util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(119), u), 15000)
request := util.NewBrowserRequest(Conf.System.NetworkProxy.String()) request := util.NewBrowserRequest(Conf.System.NetworkProxy.String())
resp, reqErr := request.Get(u) resp, reqErr := request.Get(u)
if nil != reqErr { if nil != reqErr {
@ -147,14 +148,14 @@ func NetImg2LocalAssets(rootID string) (err error) {
return ast.WalkContinue return ast.WalkContinue
}) })
if 0 < files { if 0 < files {
util.PushMsg(Conf.Language(113), 7000) util.PushUpdateMsg(msgId, Conf.Language(113), 7000)
if err = writeJSONQueue(tree); nil != err { if err = writeJSONQueue(tree); nil != err {
return return
} }
sql.WaitForWritingDatabase() sql.WaitForWritingDatabase()
util.PushMsg(fmt.Sprintf(Conf.Language(120), files), 5000) util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(120), files), 5000)
} else { } else {
util.PushMsg(Conf.Language(121), 3000) util.PushUpdateMsg(msgId, Conf.Language(121), 3000)
} }
return return
} }