mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 09:18:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
97810a5586
3 changed files with 17 additions and 13 deletions
|
|
@ -87,22 +87,14 @@ export const getAssetName = (assetPath: string) => {
|
|||
};
|
||||
|
||||
export const isLocalPath = (link: string) => {
|
||||
if (!link) {
|
||||
link = link?.trim();
|
||||
if (!link || link.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
link = link.trim();
|
||||
if (1 > link.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
link = link.toLowerCase();
|
||||
if (link.startsWith("assets/") || link.startsWith("file://") || link.startsWith("\\\\") /* Windows 网络共享路径 */) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const colonIdx = link.indexOf(":");
|
||||
return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议
|
||||
// Windows 网络共享路径双斜杠
|
||||
// 冒号前面只有一个字母认为是 Windows 盘符而不是网络协议
|
||||
return /^assets\/|file:\/\/|\\\\|[A-Z]:$/i.test(link);
|
||||
};
|
||||
|
||||
export const pathPosix = () => {
|
||||
|
|
|
|||
|
|
@ -483,6 +483,10 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChild
|
|||
}
|
||||
paragraphParents := sql.GetBlocks(paragraphParentIDs)
|
||||
for _, p := range paragraphParents {
|
||||
if nil == p {
|
||||
continue
|
||||
}
|
||||
|
||||
if "i" == p.Type || "h" == p.Type {
|
||||
linkRefs = append(linkRefs, fromSQLBlock(p, keyword, beforeLen))
|
||||
processedParagraphs.Add(p.ID)
|
||||
|
|
@ -589,6 +593,10 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
|
|||
originalRefBlockIDs = map[string]string{}
|
||||
processedParagraphs := hashset.New()
|
||||
for _, parent := range paragraphParents {
|
||||
if nil == parent {
|
||||
continue
|
||||
}
|
||||
|
||||
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
||||
refBlock := parentRefParagraphs[parent.ID]
|
||||
if nil == refBlock {
|
||||
|
|
|
|||
|
|
@ -624,6 +624,10 @@ func buildBacklinkListItemRefs(refDefs []*RefDefs) (originalRefBlockIDs map[stri
|
|||
luteEngine := util.NewLute()
|
||||
processedParagraphs := hashset.New()
|
||||
for _, parent := range paragraphParents {
|
||||
if nil == parent {
|
||||
continue
|
||||
}
|
||||
|
||||
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
||||
refBlock := parentRefParagraphs[parent.ID]
|
||||
if nil == refBlock {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue