소스 검색

:art: 导出 PDF 支持保留折叠状态 https://github.com/siyuan-note/siyuan/issues/5941

Liang Ding 2 년 전
부모
커밋
5b39560d7d
4개의 변경된 파일5개의 추가작업 그리고 13개의 파일을 삭제
  1. 5 1
      kernel/api/export.go
  2. 0 5
      kernel/model/file.go
  3. 0 5
      kernel/model/history.go
  4. 0 2
      kernel/model/template.go

+ 5 - 1
kernel/api/export.go

@@ -194,7 +194,11 @@ func exportPreviewHTML(c *gin.Context) {
 
 
 	id := arg["id"].(string)
 	id := arg["id"].(string)
 	tpl := arg["tpl"].(string)
 	tpl := arg["tpl"].(string)
-	name, content := model.ExportHTML(id, "", true, false)
+	keepFold := false
+	if arg["keepFold"] != nil {
+		keepFold = arg["keepFold"].(bool)
+	}
+	name, content := model.ExportHTML(id, "", true, keepFold)
 	// 导出 PDF 预览时点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5894
 	// 导出 PDF 预览时点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5894
 	content = strings.ReplaceAll(content, "http://127.0.0.1:"+util.ServerPort+"/#", "#")
 	content = strings.ReplaceAll(content, "http://127.0.0.1:"+util.ServerPort+"/#", "#")
 	tpl = strings.ReplaceAll(tpl, "{tpl.name}", name)
 	tpl = strings.ReplaceAll(tpl, "{tpl.name}", name)

+ 0 - 5
kernel/model/file.go

@@ -637,11 +637,6 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
 				}
 				}
 			}
 			}
 
 
-			if treenode.IsBlockRef(n) {
-				appendRefTextRenderResultForBlockRef(n)
-				return ast.WalkSkipChildren
-			}
-
 			// 支持代码块搜索定位 https://github.com/siyuan-note/siyuan/issues/5520
 			// 支持代码块搜索定位 https://github.com/siyuan-note/siyuan/issues/5520
 			if ast.NodeCodeBlockCode == n.Type && 0 < len(keywords) && !treenode.IsChartCodeBlockCode(n) {
 			if ast.NodeCodeBlockCode == n.Type && 0 < len(keywords) && !treenode.IsChartCodeBlockCode(n) {
 				text := string(n.Tokens)
 				text := string(n.Tokens)

+ 0 - 5
kernel/model/history.go

@@ -179,11 +179,6 @@ func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content stri
 			n.RemoveIALAttr("heading-fold")
 			n.RemoveIALAttr("heading-fold")
 			n.RemoveIALAttr("fold")
 			n.RemoveIALAttr("fold")
 
 
-			if treenode.IsBlockRef(n) {
-				appendRefTextRenderResultForBlockRef(n)
-				return ast.WalkSkipChildren
-			}
-
 			if ast.NodeText == n.Type {
 			if ast.NodeText == n.Type {
 				if 0 < len(keywords) {
 				if 0 < len(keywords) {
 					// 搜索高亮
 					// 搜索高亮

+ 0 - 2
kernel/model/template.go

@@ -213,8 +213,6 @@ func renderTemplate(p, id string) (string, error) {
 			(ast.NodeBlockquote == n.Type && nil != n.FirstChild && nil != n.FirstChild.Next && ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type) {
 			(ast.NodeBlockquote == n.Type && nil != n.FirstChild && nil != n.FirstChild.Next && ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type) {
 			nodesNeedAppendChild = append(nodesNeedAppendChild, n)
 			nodesNeedAppendChild = append(nodesNeedAppendChild, n)
 		}
 		}
-
-		appendRefTextRenderResultForBlockRef(n)
 		return ast.WalkContinue
 		return ast.WalkContinue
 	})
 	})
 	for _, n := range nodesNeedAppendChild {
 	for _, n := range nodesNeedAppendChild {