mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve dynamic anchor text auto-refresh stability https://github.com/siyuan-note/siyuan/issues/8234
This commit is contained in:
parent
e5df997e19
commit
1f30848d8d
3 changed files with 7 additions and 5 deletions
|
@ -1487,7 +1487,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
|
||||||
|
|
||||||
// 推送动态锚文本节点刷新
|
// 推送动态锚文本节点刷新
|
||||||
for _, defNode := range changedDefNodes {
|
for _, defNode := range changedDefNodes {
|
||||||
task.AppendAsyncTaskWithDelay(task.ReloadProtyleBlock, 200*time.Millisecond, util.PushReloadBlock, refTreeID, n.ID, defNode.id, defNode.refText)
|
task.AppendAsyncTaskWithDelay(task.SetRefDynamicText, 200*time.Millisecond, util.PushSetRefDynamicText, refTreeID, n.ID, defNode.id, defNode.refText)
|
||||||
}
|
}
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,8 @@ const (
|
||||||
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
|
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
|
||||||
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
|
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
|
||||||
ReloadAttributeView = "task.reload.attributeView" // 重新加载属性视图
|
ReloadAttributeView = "task.reload.attributeView" // 重新加载属性视图
|
||||||
ReloadProtyleBlock = "task.reload.protyleBlock" // 重载编辑器内容块
|
SetRefDynamicText = "task.ref.setDynamicText" // 设置引用的动态锚文本
|
||||||
|
SetDefRefCount = "task.def.setRefCount" // 设置定义的引用计数
|
||||||
PushMsg = "task.push.msg" // 推送消息
|
PushMsg = "task.push.msg" // 推送消息
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -150,7 +151,8 @@ var uniqueActions = []string{
|
||||||
AssetContentDatabaseIndexFull,
|
AssetContentDatabaseIndexFull,
|
||||||
AssetContentDatabaseIndexCommit,
|
AssetContentDatabaseIndexCommit,
|
||||||
ReloadAttributeView,
|
ReloadAttributeView,
|
||||||
ReloadProtyleBlock,
|
SetRefDynamicText,
|
||||||
|
SetDefRefCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
func ContainIndexTask() bool {
|
func ContainIndexTask() bool {
|
||||||
|
|
|
@ -258,8 +258,8 @@ func PushProtyleReload(rootID string) {
|
||||||
BroadcastByType("protyle", "reload", 0, "", rootID)
|
BroadcastByType("protyle", "reload", 0, "", rootID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushReloadBlock(rootID, blockID, defBlockID, refText string) {
|
func PushSetRefDynamicText(rootID, blockID, defBlockID, refText string) {
|
||||||
BroadcastByType("protyle", "reloadBlock", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText})
|
BroadcastByType("protyle", "setRefDynamicText", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText})
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushProtyleLoading(rootID, msg string) {
|
func PushProtyleLoading(rootID, msg string) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue