mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-02 10:50:15 +01:00
🎨 Alt+5 打开已有日记时不在内核伺服客户端之间同步 Fix https://github.com/siyuan-note/siyuan/issues/5617
This commit is contained in:
parent
9fb4d9da2a
commit
8ac1104d6f
5 changed files with 41 additions and 11 deletions
|
|
@ -1012,7 +1012,7 @@ func CreateWithMarkdown(boxID, hPath, md string) (id string, err error) {
|
|||
WaitForWritingFiles()
|
||||
luteEngine := NewLute()
|
||||
dom := luteEngine.Md2BlockDOM(md)
|
||||
id, err = createDocsByHPath(box.ID, hPath, dom)
|
||||
id, _, err = createDocsByHPath(box.ID, hPath, dom)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -1311,7 +1311,7 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func CreateDailyNote(boxID string) (p string, err error) {
|
||||
func CreateDailyNote(boxID string) (p string, existed bool, err error) {
|
||||
box := Conf.Box(boxID)
|
||||
if nil == box {
|
||||
err = ErrBoxNotFound
|
||||
|
|
@ -1333,11 +1333,12 @@ func CreateDailyNote(boxID string) (p string, err error) {
|
|||
|
||||
existRoot := treenode.GetBlockTreeRootByHPath(box.ID, hPath)
|
||||
if nil != existRoot {
|
||||
existed = true
|
||||
p = existRoot.Path
|
||||
return
|
||||
}
|
||||
|
||||
id, err := createDocsByHPath(box.ID, hPath, "")
|
||||
id, existed, err := createDocsByHPath(box.ID, hPath, "")
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func createDocsByHPath(boxID, hPath, content string) (id string, err error) {
|
||||
func createDocsByHPath(boxID, hPath, content string) (id string, existed bool, err error) {
|
||||
hPath = strings.TrimSuffix(hPath, ".sy")
|
||||
if docExist := nil != treenode.GetBlockTreeRootByHPath(boxID, hPath); docExist {
|
||||
if existed = nil != treenode.GetBlockTreeRootByHPath(boxID, hPath); existed {
|
||||
hPath += "-" + gulu.Rand.String(7)
|
||||
}
|
||||
pathBuilder := bytes.Buffer{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue