From 57c094ee1562a1122fade87d8cee6bb89d8a526b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 23 Jun 2022 10:53:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=B6=85=E9=93=BE=E6=8E=A5=E5=85=83=E7=B4=A0=20URL=20?= =?UTF-8?q?Fix=20https://github.com/siyuan-note/siyuan/issues/5273?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/sql/database.go | 18 +++++++++++++++++- kernel/treenode/node.go | 11 ++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/kernel/sql/database.go b/kernel/sql/database.go index 92ad086a3..0e913e08a 100644 --- a/kernel/sql/database.go +++ b/kernel/sql/database.go @@ -506,6 +506,22 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) ( walkStatus = ast.WalkSkipChildren return case ast.NodeLinkDest: + text := n.TokensStr() + markdown := treenode.FormatNode(n.Parent, luteEngine) + parentBlock := treenode.ParentBlock(n) + span := &Span{ + ID: ast.NewNodeID(), + BlockID: parentBlock.ID, + RootID: rootID, + Box: boxID, + Path: p, + Content: text, + Markdown: markdown, + Type: treenode.TypeAbbr(n.Type.String()), + IAL: treenode.IALStr(n), + } + spans = append(spans, span) + // assetsLinkDestsInTree if !IsAssetLinkDest(n.Tokens) { @@ -514,7 +530,7 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) ( } dest := gulu.Str.FromBytes(n.Tokens) - parentBlock := treenode.ParentBlock(n) + parentBlock = treenode.ParentBlock(n) var title string if titleNode := n.Parent.ChildByType(ast.NodeLinkTitle); nil != titleNode { title = gulu.Str.FromBytes(titleNode.Tokens) diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 06295275a..f5aa75357 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -75,7 +75,15 @@ func NodeStaticContent(node *ast.Node) string { buf.WriteString(GetDynamicBlockRefText(n)) lastSpace = false return ast.WalkSkipChildren - case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, + case ast.NodeLinkText: + buf.Write(n.Tokens) + buf.WriteByte(' ') + case ast.NodeLinkDest: + buf.Write(n.Tokens) + buf.WriteByte(' ') + case ast.NodeLinkTitle: + buf.Write(n.Tokens) + case ast.NodeText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock: buf.Write(n.Tokens) case ast.NodeBackslash: @@ -204,6 +212,7 @@ var typeAbbrMap = map[string]string{ // 行级元素 "NodeText": "text", "NodeLinkText": "link_text", + "NodeLinkDest": "link_dest", "NodeTag": "tag", "NodeCodeSpan": "code_span", "NodeInlineMath": "inline_math", From 4d0a71ce07cc028f1589039c9b5c052f9a9c1c93 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 23 Jun 2022 10:59:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E7=AD=BE=E6=89=93=E5=BC=80=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E6=95=B0=E9=87=8F=20https://github.com/siyuan-note/siyuan/issu?= =?UTF-8?q?es/2098?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/conf/filetree.go | 2 ++ kernel/model/conf.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/kernel/conf/filetree.go b/kernel/conf/filetree.go index 3c67832bd..9cfc03dac 100644 --- a/kernel/conf/filetree.go +++ b/kernel/conf/filetree.go @@ -26,6 +26,7 @@ type FileTree struct { RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储文件夹路径 CreateDocNameTemplate string `json:"createDocNameTemplate"` // 新建文档名模板 MaxListCount int `json:"maxListCount"` // 最大列出数量 + MaxOpenTabCount int `json:"maxOpenTabCount"` // 最大打开页签数量 AllowCreateDeeper bool `json:"allowCreateDeeper"` // 允许创建超过 7 层深度的子文档 RemoveDocWithoutConfirm bool `json:"removeDocWithoutConfirm"` // 删除文档时是否不需要确认 @@ -39,6 +40,7 @@ func NewFileTree() *FileTree { Sort: util.SortModeCustom, CreateDocNameTemplate: "", MaxListCount: 512, + MaxOpenTabCount: 12, AllowCreateDeeper: false, } } diff --git a/kernel/model/conf.go b/kernel/model/conf.go index c2cf8352f..ce6a1f882 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -130,6 +130,9 @@ func InitConf() { if 1 > Conf.FileTree.MaxListCount { Conf.FileTree.MaxListCount = 512 } + if 1 > Conf.FileTree.MaxOpenTabCount { + Conf.FileTree.MaxOpenTabCount = 12 + } if nil == Conf.Tag { Conf.Tag = conf.NewTag() }