mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-01 02:10:15 +01:00
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
a8f56e55e3
commit
957a928959
6 changed files with 82 additions and 19 deletions
|
|
@ -26,6 +26,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/bazaar"
|
||||
"github.com/siyuan-note/siyuan/kernel/task"
|
||||
|
|
@ -254,6 +255,9 @@ func UninstallBazaarPlugin(pluginName, frontend string) error {
|
|||
}
|
||||
petals = tmp
|
||||
savePetals(petals)
|
||||
|
||||
removePluginSet := hashset.New(pluginName)
|
||||
pushReloadPlugin(nil, removePluginSet, "")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/av"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
|
|
@ -37,6 +38,42 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func PushReloadPlugin(upsertPluginSet, removePluginNameSet *hashset.Set, excludeApp string) {
|
||||
pushReloadPlugin(upsertPluginSet, removePluginNameSet, excludeApp)
|
||||
}
|
||||
|
||||
func pushReloadPlugin(upsertPluginSet, removePluginNameSet *hashset.Set, excludeApp string) {
|
||||
upsertPlugins, removePlugins := []string{}, []string{}
|
||||
if nil != upsertPluginSet {
|
||||
for _, n := range upsertPluginSet.Values() {
|
||||
upsertPlugins = append(upsertPlugins, n.(string))
|
||||
}
|
||||
}
|
||||
if nil != removePluginNameSet {
|
||||
for _, n := range removePluginNameSet.Values() {
|
||||
removePlugins = append(removePlugins, n.(string))
|
||||
}
|
||||
}
|
||||
|
||||
pushReloadPlugin0(upsertPlugins, removePlugins, excludeApp)
|
||||
}
|
||||
|
||||
func pushReloadPlugin0(upsertPlugins, removePlugins []string, excludeApp string) {
|
||||
logging.LogInfof("reload plugins [upserts=%v, removes=%v]", upsertPlugins, removePlugins)
|
||||
if "" == excludeApp {
|
||||
util.BroadcastByType("main", "reloadPlugin", 0, "", map[string]interface{}{
|
||||
"upsertPlugins": upsertPlugins,
|
||||
"removePlugins": removePlugins,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
util.BroadcastByTypeAndExcludeApp(excludeApp, "main", "reloadPlugin", 0, "", map[string]interface{}{
|
||||
"upsertPlugins": upsertPlugins,
|
||||
"removePlugins": removePlugins,
|
||||
})
|
||||
}
|
||||
|
||||
func refreshDocInfo(tree *parse.Tree) {
|
||||
if nil == tree {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1690,7 +1690,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
}
|
||||
|
||||
if needReloadPlugin {
|
||||
pushReloadPlugin(upsertPluginSet, removePluginSet)
|
||||
pushReloadPlugin(upsertPluginSet, removePluginSet, "")
|
||||
}
|
||||
|
||||
for _, widgetDir := range removeWidgetDirSet.Values() {
|
||||
|
|
@ -2258,19 +2258,3 @@ func getCloudSpace() (stat *cloud.Stat, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func pushReloadPlugin(upsertPluginSet, removePluginNameSet *hashset.Set) {
|
||||
upsertPlugins, removePlugins := []string{}, []string{}
|
||||
for _, n := range upsertPluginSet.Values() {
|
||||
upsertPlugins = append(upsertPlugins, n.(string))
|
||||
}
|
||||
for _, n := range removePluginNameSet.Values() {
|
||||
removePlugins = append(removePlugins, n.(string))
|
||||
}
|
||||
|
||||
logging.LogInfof("reload plugins [upserts=%v, removes=%v]", upsertPlugins, removePlugins)
|
||||
util.BroadcastByType("main", "reloadPlugin", 0, "", map[string]interface{}{
|
||||
"upsertPlugins": upsertPlugins,
|
||||
"removePlugins": removePlugins,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue