Browse Source

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 year ago
parent
commit
bff480397b
5 changed files with 14 additions and 19 deletions
  1. 0 0
      app/stage/protyle/js/lute/lute.min.js
  2. 3 5
      kernel/api/transaction.go
  3. 1 1
      kernel/go.mod
  4. 2 2
      kernel/go.sum
  5. 8 11
      kernel/model/export.go

File diff suppressed because it is too large
+ 0 - 0
app/stage/protyle/js/lute/lute.min.js


+ 3 - 5
kernel/api/transaction.go

@@ -72,11 +72,9 @@ func performTransactions(c *gin.Context) {
 	session := arg["session"].(string)
 	pushTransactions(app, session, transactions)
 
-	if model.IsFoldHeading(&transactions) || model.IsUnfoldHeading(&transactions) || model.IsMoveOutlineHeading(&transactions) {
-		if model.IsMoveOutlineHeading(&transactions) {
-			if retData := transactions[0].DoOperations[0].RetData; nil != retData {
-				util.PushReloadDoc(retData.(string))
-			}
+	if model.IsMoveOutlineHeading(&transactions) {
+		if retData := transactions[0].DoOperations[0].RetData; nil != retData {
+			util.PushReloadDoc(retData.(string))
 		}
 	}
 

+ 1 - 1
kernel/go.mod

@@ -8,7 +8,7 @@ require (
 	github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
 	github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
 	github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02
-	github.com/88250/lute v1.7.7-0.20240624092513-3eb6d0e18c99
+	github.com/88250/lute v1.7.7-0.20240624141038-a066485dd2b3
 	github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
 	github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
 	github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

+ 2 - 2
kernel/go.sum

@@ -12,8 +12,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
 github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
 github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02 h1:3e5+yobj655pTeKOYMbJrnc1mE51ZkbXIxquTYZuYCY=
 github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
-github.com/88250/lute v1.7.7-0.20240624092513-3eb6d0e18c99 h1:cxpmJ9No3AcpMyboIzp0u4KPCrLrVh3xsJ+U1YljbAA=
-github.com/88250/lute v1.7.7-0.20240624092513-3eb6d0e18c99/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
+github.com/88250/lute v1.7.7-0.20240624141038-a066485dd2b3 h1:mqoLTyzwLxx0i8bSaZsm/PDLc670ECDD1FYHtTbv2+k=
+github.com/88250/lute v1.7.7-0.20240624141038-a066485dd2b3/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
 github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
 github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
 github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

+ 8 - 11
kernel/model/export.go

@@ -535,7 +535,7 @@ func ExportResources(resourcePaths []string, mainName string) (exportFilePath st
 
 func Preview(id string) (retStdHTML string, retOutline []*Path) {
 	tree, _ := LoadTreeByBlockID(id)
-	tree = exportTree(tree, false, false, true,
+	tree = exportTree(tree, false, false,
 		Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
 		Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
 		Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@@ -640,7 +640,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
 		}
 	}
 
-	tree = exportTree(tree, true, false, !docx,
+	tree = exportTree(tree, true, false,
 		Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
 		Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
 		Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@@ -790,7 +790,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
 		}
 	}
 
-	tree = exportTree(tree, true, keepFold, true,
+	tree = exportTree(tree, true, keepFold,
 		Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
 		Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
 		Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@@ -1837,7 +1837,7 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
 	blockRefTextLeft, blockRefTextRight string,
 	addTitle bool,
 	defBlockIDs []string) (ret string) {
-	tree = exportTree(tree, false, false, true,
+	tree = exportTree(tree, false, false,
 		blockRefMode, blockEmbedMode, fileAnnotationRefMode,
 		tagOpenMarker, tagCloseMarker,
 		blockRefTextLeft, blockRefTextRight,
@@ -1926,7 +1926,7 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
 	return
 }
 
-func exportTree(tree *parse.Tree, wysiwyg, keepFold, pdfPageNum bool,
+func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
 	blockRefMode, blockEmbedMode, fileAnnotationRefMode int,
 	tagOpenMarker, tagCloseMarker string,
 	blockRefTextLeft, blockRefTextRight string,
@@ -1975,7 +1975,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, pdfPageNum bool,
 					return ast.WalkSkipChildren
 				}
 
-				status := processFileAnnotationRef(refID, n, fileAnnotationRefMode, pdfPageNum)
+				status := processFileAnnotationRef(refID, n, fileAnnotationRefMode)
 				unlinks = append(unlinks, n)
 				return status
 			} else if n.IsTextMarkType("tag") {
@@ -2551,7 +2551,7 @@ func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree) {
 	})
 }
 
-func processFileAnnotationRef(refID string, n *ast.Node, fileAnnotationRefMode int, pdfPageNum bool) ast.WalkStatus {
+func processFileAnnotationRef(refID string, n *ast.Node, fileAnnotationRefMode int) ast.WalkStatus {
 	p := refID[:strings.LastIndex(refID, "/")]
 	absPath, err := GetAssetAbsPath(p)
 	if nil != err {
@@ -2591,10 +2591,7 @@ func processFileAnnotationRef(refID string, n *ast.Node, fileAnnotationRefMode i
 	}
 	fileAnnotationRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
 	fileAnnotationRefLink.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
-	dest := p
-	if pdfPageNum {
-		dest += "?p=" + pageStr
-	}
+	dest := p + "#page=" + pageStr // https://github.com/siyuan-note/siyuan/issues/11780
 	fileAnnotationRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(dest)})
 	fileAnnotationRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
 	n.InsertBefore(fileAnnotationRefLink)

Some files were not shown because too many files changed in this diff