mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 PDF 标注预览失效 Fix https://github.com/siyuan-note/siyuan/issues/5934
This commit is contained in:
parent
fe6d68c3e7
commit
6560b0ce96
1 changed files with 28 additions and 0 deletions
|
|
@ -300,6 +300,34 @@ func refsFromTree(tree *parse.Tree) (refs []*Ref, fileAnnotationRefs []*FileAnno
|
||||||
Type: treenode.TypeAbbr(n.Type.String()),
|
Type: treenode.TypeAbbr(n.Type.String()),
|
||||||
}
|
}
|
||||||
fileAnnotationRefs = append(fileAnnotationRefs, ref)
|
fileAnnotationRefs = append(fileAnnotationRefs, ref)
|
||||||
|
} else if ast.NodeTextMark == n.Type && n.IsTextMarkType("file-annotation-ref") {
|
||||||
|
pathID := n.TextMarkFileAnnotationRefID
|
||||||
|
idx := strings.LastIndex(pathID, "/")
|
||||||
|
if -1 == idx {
|
||||||
|
return ast.WalkContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
filePath := pathID[:idx]
|
||||||
|
annotationID := pathID[idx+1:]
|
||||||
|
|
||||||
|
anchor := n.TextMarkTextContent
|
||||||
|
text := filePath
|
||||||
|
if "" != anchor {
|
||||||
|
text = anchor
|
||||||
|
}
|
||||||
|
parentBlock := treenode.ParentBlock(n)
|
||||||
|
ref := &FileAnnotationRef{
|
||||||
|
ID: ast.NewNodeID(),
|
||||||
|
FilePath: filePath,
|
||||||
|
AnnotationID: annotationID,
|
||||||
|
BlockID: parentBlock.ID,
|
||||||
|
RootID: tree.ID,
|
||||||
|
Box: tree.Box,
|
||||||
|
Path: tree.Path,
|
||||||
|
Content: text,
|
||||||
|
Type: treenode.TypeAbbr(n.Type.String()),
|
||||||
|
}
|
||||||
|
fileAnnotationRefs = append(fileAnnotationRefs, ref)
|
||||||
}
|
}
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue