🐛 文档转换标题后文档树刷新不正确 https://github.com/siyuan-note/siyuan/issues/7435

This commit is contained in:
Liang Ding 2023-02-22 08:31:46 +08:00
parent c65a88db88
commit 685d47452d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 7 additions and 4 deletions

View file

@ -818,10 +818,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
after: targetElement.classList.contains("dragover__bottom"),
targetID: targetElement.getAttribute("data-node-id"),
});
fetchPost("/api/filetree/removeDoc", {
notebook: response.data.srcTreeBox,
path: response.data.srcTreePath,
});
}
}
fetchPost("/api/filetree/getDoc", {

View file

@ -224,6 +224,13 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st
contentPivot.Unlink()
}
// 推送给前端移除旧文档
evt := util.NewCmdResult("removeDoc", 0, util.PushModeBroadcast)
evt.Data = map[string]interface{}{
"ids": []string{srcTree.Root.ID},
}
util.PushEvent(evt)
srcTreeBox, srcTreePath = srcTree.Box, srcTree.Path // 返回旧的文档块位置,前端后续会删除旧的文档块
targetTree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
err = indexWriteJSONQueue(targetTree)