mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 23:42:36 +08:00
♻️ Refactor push reload filetree, tag and protyle
This commit is contained in:
parent
ebb74238c9
commit
246efd5938
@ -29,14 +29,14 @@ func reloadTag(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
util.PushReloadTag()
|
||||
model.ReloadTag()
|
||||
}
|
||||
|
||||
func reloadFiletree(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
util.PushReloadFiletree()
|
||||
model.ReloadFiletree()
|
||||
}
|
||||
|
||||
func reloadProtyle(c *gin.Context) {
|
||||
|
@ -31,7 +31,7 @@ func AutoSpace(rootID string) (err error) {
|
||||
|
||||
logging.LogInfof("formatting tree [%s]...", rootID)
|
||||
util.PushProtyleLoading(rootID, Conf.Language(116))
|
||||
defer util.PushReloadProtyle(rootID)
|
||||
defer ReloadProtyle(rootID)
|
||||
|
||||
FlushTxQueue()
|
||||
|
||||
|
@ -318,8 +318,8 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
||||
if writeErr := indexWriteTreeIndexQueue(tree); nil != writeErr {
|
||||
return
|
||||
}
|
||||
util.PushReloadFiletree()
|
||||
util.PushReloadProtyle(rootID)
|
||||
ReloadFiletree()
|
||||
ReloadProtyle(rootID)
|
||||
util.PushMsg(Conf.Language(102), 3000)
|
||||
|
||||
IncSync()
|
||||
|
@ -104,6 +104,14 @@ func refreshDocInfo0(tree *parse.Tree, size uint64) {
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadProtyle, 500*time.Millisecond, util.PushReloadDocInfo, docInfo)
|
||||
}
|
||||
|
||||
func ReloadFiletree() {
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadFiletree, 200*time.Millisecond, util.PushReloadFiletree)
|
||||
}
|
||||
|
||||
func ReloadTag() {
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadTag, 200*time.Millisecond, util.PushReloadTag)
|
||||
}
|
||||
|
||||
func ReloadProtyle(rootID string) {
|
||||
// 刷新关联的引用
|
||||
defTree, _ := LoadTreeByBlockID(rootID)
|
||||
|
@ -1692,7 +1692,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
||||
upsertRootIDs, removeRootIDs := incReindex(upserts, removes)
|
||||
needReloadFiletree = !needReloadUI && (needReloadFiletree || 0 < len(upsertRootIDs) || 0 < len(removeRootIDs))
|
||||
if needReloadFiletree {
|
||||
util.PushReloadFiletree()
|
||||
ReloadFiletree()
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
@ -800,7 +800,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
||||
unlinks = append(unlinks, n)
|
||||
}
|
||||
|
||||
util.PushReloadTag()
|
||||
ReloadTag()
|
||||
} else if n.IsTextMarkType("u") {
|
||||
if !replaceTypes["u"] {
|
||||
return ast.WalkContinue
|
||||
|
@ -136,6 +136,8 @@ const (
|
||||
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
|
||||
ReloadAttributeView = "task.reload.attributeView" // 重新加载属性视图
|
||||
ReloadProtyle = "task.reload.protyle" // 重新加载编辑器
|
||||
ReloadTag = "task.reload.tag" // 重新加载标签面板
|
||||
ReloadFiletree = "task.reload.filetree" // 重新加载文档树面板
|
||||
SetRefDynamicText = "task.ref.setDynamicText" // 设置引用的动态锚文本
|
||||
SetDefRefCount = "task.def.setRefCount" // 设置定义的引用计数
|
||||
UpdateIDs = "task.update.ids" // 更新 ID
|
||||
@ -156,6 +158,8 @@ var uniqueActions = []string{
|
||||
AssetContentDatabaseIndexCommit,
|
||||
ReloadAttributeView,
|
||||
ReloadProtyle,
|
||||
ReloadTag,
|
||||
ReloadFiletree,
|
||||
SetRefDynamicText,
|
||||
SetDefRefCount,
|
||||
UpdateIDs,
|
||||
|
Loading…
Reference in New Issue
Block a user