mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-12 18:24:21 +01:00
🎨 Plugins should be reloaded after the data sync https://github.com/siyuan-note/siyuan/issues/10203
This commit is contained in:
parent
c853fddcff
commit
db690c51b6
1 changed files with 20 additions and 3 deletions
|
|
@ -1374,14 +1374,15 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
// 有数据变更,需要重建索引
|
||||
var upserts, removes []string
|
||||
var upsertTrees int
|
||||
var needReloadFlashcard, needReloadOcrTexts, needReloadFiletree bool
|
||||
// 可能需要重新加载部分功能
|
||||
var needReloadFlashcard, needReloadOcrTexts, needReloadFiletree, needReloadPlugin 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") {
|
||||
if strings.HasPrefix(file.Path, "/assets/ocr-texts.json") {
|
||||
needReloadOcrTexts = true
|
||||
}
|
||||
|
||||
|
|
@ -1389,6 +1390,10 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
needReloadFiletree = true
|
||||
}
|
||||
|
||||
if strings.HasPrefix(file.Path, "/storage/petal/") {
|
||||
needReloadPlugin = true
|
||||
}
|
||||
|
||||
if strings.HasSuffix(file.Path, ".sy") {
|
||||
upsertTrees++
|
||||
}
|
||||
|
|
@ -1399,13 +1404,17 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
needReloadFlashcard = true
|
||||
}
|
||||
|
||||
if strings.HasPrefix(file.Path, "/data/assets/ocr-texts.json") {
|
||||
if strings.HasPrefix(file.Path, "/assets/ocr-texts.json") {
|
||||
needReloadOcrTexts = true
|
||||
}
|
||||
|
||||
if strings.HasSuffix(file.Path, "/.siyuan/conf.json") {
|
||||
needReloadFiletree = true
|
||||
}
|
||||
|
||||
if strings.HasPrefix(file.Path, "/storage/petal/") {
|
||||
needReloadPlugin = true
|
||||
}
|
||||
}
|
||||
|
||||
if needReloadFlashcard {
|
||||
|
|
@ -1416,6 +1425,10 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
LoadAssetsTexts()
|
||||
}
|
||||
|
||||
if needReloadPlugin {
|
||||
pushReloadPlugin()
|
||||
}
|
||||
|
||||
syncingFiles = sync.Map{}
|
||||
syncingStorages.Store(false)
|
||||
|
||||
|
|
@ -1951,3 +1964,7 @@ func getCloudSpace() (stat *cloud.Stat, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func pushReloadPlugin() {
|
||||
util.BroadcastByType("main", "reloadPlugin", 0, "", nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue