🎨 数据同步后需要重新加载图片 OCR 提取结果 Fix https://github.com/siyuan-note/siyuan/issues/7114

This commit is contained in:
Liang Ding 2023-01-18 16:20:57 +08:00
parent 9c626ebc0b
commit 175a938eec
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 21 additions and 9 deletions

View file

@ -989,13 +989,17 @@ func syncRepo(exit, byHand bool) (err error) {
// 有数据变更,需要重建索引
var upserts, removes []string
var upsertTrees int
var needReloadFlashcard bool
var needReloadFlashcard, needReloadOcrTexts bool
for _, file := range mergeResult.Upserts {
upserts = append(upserts, file.Path)
if strings.HasPrefix(file.Path, "/storage/riff/") {
needReloadFlashcard = true
}
if strings.HasPrefix(file.Path, "/data/assets/ocr-texts.json") {
needReloadOcrTexts = true
}
if strings.HasSuffix(file.Path, ".sy") {
upsertTrees++
}
@ -1005,10 +1009,18 @@ func syncRepo(exit, byHand bool) (err error) {
if strings.HasPrefix(file.Path, "/storage/riff/") {
needReloadFlashcard = true
}
if strings.HasPrefix(file.Path, "/data/assets/ocr-texts.json") {
needReloadOcrTexts = true
}
}
if needReloadFlashcard {
InitFlashcards()
LoadFlashcards()
}
if needReloadOcrTexts {
LoadAssetsTexts()
}
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939