Skip to content

Commit

Permalink
🧑‍💻 Push update block ID event #13434
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 11, 2024
1 parent 50793ad commit 225adea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/model/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -612,6 +613,8 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
}

IncSync()

task.AppendTask(task.UpdateIDs, util.PushUpdateIDs, blockIDs)
return
}

Expand Down
2 changes: 2 additions & 0 deletions kernel/task/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" // 推送消息
)

Expand All @@ -157,6 +158,7 @@ var uniqueActions = []string{
ReloadProtyle,
SetRefDynamicText,
SetDefRefCount,
UpdateIDs,
}

func ContainIndexTask() bool {
Expand Down
4 changes: 4 additions & 0 deletions kernel/util/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 225adea

Please sign in to comment.