mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve refreshing of doc tree when creating doc https://github.com/siyuan-note/siyuan/issues/12109
This commit is contained in:
parent
5fca28ca81
commit
5ddda02aba
1 changed files with 14 additions and 23 deletions
|
|
@ -695,16 +695,8 @@ func createDoc(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
model.FlushTxQueue()
|
model.FlushTxQueue()
|
||||||
|
box := model.Conf.Box(notebook)
|
||||||
pushCreateEvt := false
|
pushCreate(box, p, arg)
|
||||||
pushCreateEvtArg := arg["pushCreateEvt"]
|
|
||||||
if nil != pushCreateEvtArg {
|
|
||||||
pushCreateEvt = pushCreateEvtArg.(bool)
|
|
||||||
}
|
|
||||||
if pushCreateEvt {
|
|
||||||
box := model.Conf.Box(notebook)
|
|
||||||
pushCreate(box, p, arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"id": tree.Root.ID,
|
"id": tree.Root.ID,
|
||||||
|
|
@ -837,17 +829,9 @@ func createDocWithMd(c *gin.Context) {
|
||||||
ret.Data = id
|
ret.Data = id
|
||||||
|
|
||||||
model.FlushTxQueue()
|
model.FlushTxQueue()
|
||||||
|
box := model.Conf.Box(notebook)
|
||||||
pushCreateEvt := false
|
b, _ := model.GetBlock(id, nil)
|
||||||
pushCreateEvtArg := arg["pushCreateEvt"]
|
pushCreate(box, b.Path, arg)
|
||||||
if nil != pushCreateEvtArg {
|
|
||||||
pushCreateEvt = pushCreateEvtArg.(bool)
|
|
||||||
}
|
|
||||||
if pushCreateEvt {
|
|
||||||
box := model.Conf.Box(notebook)
|
|
||||||
b, _ := model.GetBlock(id, nil)
|
|
||||||
pushCreate(box, b.Path, arg)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDocCreateSavePath(c *gin.Context) {
|
func getDocCreateSavePath(c *gin.Context) {
|
||||||
|
|
@ -1157,9 +1141,16 @@ func getDoc(c *gin.Context) {
|
||||||
|
|
||||||
func pushCreate(box *model.Box, p string, arg map[string]interface{}) {
|
func pushCreate(box *model.Box, p string, arg map[string]interface{}) {
|
||||||
evt := util.NewCmdResult("create", 0, util.PushModeBroadcast)
|
evt := util.NewCmdResult("create", 0, util.PushModeBroadcast)
|
||||||
|
listDocTree := false
|
||||||
|
listDocTreeArg := arg["listDocTree"]
|
||||||
|
if nil != listDocTreeArg {
|
||||||
|
listDocTree = listDocTreeArg.(bool)
|
||||||
|
}
|
||||||
|
|
||||||
evt.Data = map[string]interface{}{
|
evt.Data = map[string]interface{}{
|
||||||
"box": box,
|
"box": box,
|
||||||
"path": p,
|
"path": p,
|
||||||
|
"listDocTree": listDocTree,
|
||||||
}
|
}
|
||||||
evt.Callback = arg["callback"]
|
evt.Callback = arg["callback"]
|
||||||
util.PushEvent(evt)
|
util.PushEvent(evt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue