@@ -38,15 +38,38 @@ import (
3838 "github.com/siyuan-note/siyuan/kernel/util"
3939)
4040
41- func PushReloadPlugin (upsertPluginSet , removePluginNameSet * hashset.Set , excludeApp string ) {
42- pushReloadPlugin (upsertPluginSet , removePluginNameSet , excludeApp )
43- }
41+ func PushReloadPlugin (upsertCodePluginSet , upsertDataPluginSet , removePluginNameSet * hashset.Set , excludeApp string ) {
42+ if nil != removePluginNameSet {
43+ for _ , n := range removePluginNameSet .Values () {
44+ pluginName := n .(string )
45+ // 如果插件在 removePluginSet 中,从其他集合中移除
46+ if nil != upsertCodePluginSet {
47+ upsertCodePluginSet .Remove (pluginName )
48+ }
49+ if nil != upsertDataPluginSet {
50+ upsertDataPluginSet .Remove (pluginName )
51+ }
52+ }
53+ }
54+ if nil != upsertCodePluginSet {
55+ for _ , n := range upsertCodePluginSet .Values () {
56+ pluginName := n .(string )
57+ // 如果插件在 upsertCodePluginSet 中,从 upsertDataPluginSet 中移除
58+ if nil != upsertDataPluginSet {
59+ upsertDataPluginSet .Remove (pluginName )
60+ }
61+ }
62+ }
4463
45- func pushReloadPlugin (upsertPluginSet , removePluginNameSet * hashset.Set , excludeApp string ) {
46- upsertPlugins , removePlugins := []string {}, []string {}
47- if nil != upsertPluginSet {
48- for _ , n := range upsertPluginSet .Values () {
49- upsertPlugins = append (upsertPlugins , n .(string ))
64+ upsertCodePlugins , upsertDataPlugins , removePlugins := []string {}, []string {}, []string {}
65+ if nil != upsertCodePluginSet {
66+ for _ , n := range upsertCodePluginSet .Values () {
67+ upsertCodePlugins = append (upsertCodePlugins , n .(string ))
68+ }
69+ }
70+ if nil != upsertDataPluginSet {
71+ for _ , n := range upsertDataPluginSet .Values () {
72+ upsertDataPlugins = append (upsertDataPlugins , n .(string ))
5073 }
5174 }
5275 if nil != removePluginNameSet {
@@ -55,22 +78,24 @@ func pushReloadPlugin(upsertPluginSet, removePluginNameSet *hashset.Set, exclude
5578 }
5679 }
5780
58- pushReloadPlugin0 (upsertPlugins , removePlugins , excludeApp )
81+ pushReloadPlugin0 (upsertCodePlugins , upsertDataPlugins , removePlugins , excludeApp )
5982}
6083
61- func pushReloadPlugin0 (upsertPlugins , removePlugins []string , excludeApp string ) {
62- logging .LogInfof ("reload plugins [upserts =%v, removes=%v]" , upsertPlugins , removePlugins )
84+ func pushReloadPlugin0 (upsertCodePlugins , upsertDataPlugins , removePlugins []string , excludeApp string ) {
85+ logging .LogInfof ("reload plugins [codeChanges =%v, dataChanges=%v, removes=%v]" , upsertCodePlugins , upsertDataPlugins , removePlugins )
6386 if "" == excludeApp {
6487 util .BroadcastByType ("main" , "reloadPlugin" , 0 , "" , map [string ]interface {}{
65- "upsertPlugins" : upsertPlugins ,
66- "removePlugins" : removePlugins ,
88+ "upsertCodePlugins" : upsertCodePlugins ,
89+ "upsertDataPlugins" : upsertDataPlugins ,
90+ "removePlugins" : removePlugins ,
6791 })
6892 return
6993 }
7094
7195 util .BroadcastByTypeAndExcludeApp (excludeApp , "main" , "reloadPlugin" , 0 , "" , map [string ]interface {}{
72- "upsertPlugins" : upsertPlugins ,
73- "removePlugins" : removePlugins ,
96+ "upsertCodePlugins" : upsertCodePlugins ,
97+ "upsertDataPlugins" : upsertDataPlugins ,
98+ "removePlugins" : removePlugins ,
7499 })
75100}
76101
0 commit comments