Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:technologist: Push update block ID event https://github.com/siyuan-note/siyuan/issues/13434

Daniel225adea9b6b3
diff --git a/kernel/model/import.go b/kernel/model/import.go
index 1745c6d0d1..7a587d5cee 100644
--- a/kernel/model/import.go
+++ b/kernel/model/import.go
@@ -49,6 +49,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/av"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/sql"
+ "github.com/siyuan-note/siyuan/kernel/task"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -612,6 +613,8 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
}
IncSync()
+
+ task.AppendTask(task.UpdateIDs, util.PushUpdateIDs, blockIDs)
return
}
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index 30f47ca59d..02f8197baa 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -138,6 +138,7 @@ const (
ReloadProtyle = "task.reload.protyle" // 重新加载编辑器
SetRefDynamicText = "task.ref.setDynamicText" // 设置引用的动态锚文本
SetDefRefCount = "task.def.setRefCount" // 设置定义的引用计数
+ UpdateIDs = "task.update.ids" // 更新 ID
PushMsg = "task.push.msg" // 推送消息
)
@@ -157,6 +158,7 @@ var uniqueActions = []string{
ReloadProtyle,
SetRefDynamicText,
SetDefRefCount,
+ UpdateIDs,
}
func ContainIndexTask() bool {
diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go
index cf43e93447..b01f007fc4 100644
--- a/kernel/util/websocket.go
+++ b/kernel/util/websocket.go
@@ -241,6 +241,10 @@ func PushClearProgress() {
BroadcastByType("main", "cprogress", 0, "", nil)
}
+func PushUpdateIDs(ids map[string]string) {
+ BroadcastByType("main", "updateids", 0, "", ids)
+}
+
func PushReloadDoc(rootID string) {
BroadcastByType("main", "reloaddoc", 0, "", rootID)
}