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

This commit is contained in:
Vanessa 2025-02-16 18:04:16 +08:00
commit e1218a1381
4 changed files with 56 additions and 11 deletions

View file

@ -426,7 +426,7 @@ export const setFilter = async (options: {
<option value="0"${showToday ? " selected" : ""}>${window.siyuan.languages.current}</option>
</select>
<span class="fn__space"></span>
<input type="number" min="1" step="1" value="${options.filter.relativeDate?.count || 1}" class="b3-text-field fn__flex-1${showToday ? " fn__none" : ""}"/>
<input type="number" min="1" oninput="this.value = Math.max(this.value, 1)" step="1" value="${options.filter.relativeDate?.count || 1}" class="b3-text-field fn__flex-1${showToday ? " fn__none" : ""}"/>
<span class="fn__space${showToday ? " fn__none" : ""}"></span>
<select class="b3-select fn__flex-1">
<option value="0"${options.filter.relativeDate?.unit === 0 ? " selected" : ""}>${window.siyuan.languages.day}</option>
@ -449,7 +449,7 @@ export const setFilter = async (options: {
<option value="0"${showToday2 ? " selected" : ""}>${window.siyuan.languages.current}</option>
</select>
<span class="fn__space"></span>
<input type="number" min="1" step="1" value="${options.filter.relativeDate2?.count || 1}" class="b3-text-field fn__flex-1${showToday2 ? " fn__none" : ""}"/>
<input type="number" min="1" step="1" oninput="this.value = Math.max(this.value, 1)" value="${options.filter.relativeDate2?.count || 1}" class="b3-text-field fn__flex-1${showToday2 ? " fn__none" : ""}"/>
<span class="fn__space${showToday2 ? " fn__none" : ""}"></span>
<select class="b3-select fn__flex-1">
<option value="0"${options.filter.relativeDate2?.unit === 0 ? " selected" : ""}>${window.siyuan.languages.day}</option>

View file

@ -592,7 +592,23 @@ func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterO
return valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd)
case FilterOperatorIsBetween:
if RelativeDateDirectionBefore == direction {
if RelativeDateDirectionBefore == direction2 || RelativeDateDirectionAfter == direction2 {
if RelativeDateDirectionBefore == direction2 {
var leftStart, rightEnd time.Time
if otherValueStart.Before(otherValueStart2) {
leftStart = otherValueStart
} else {
leftStart = otherValueStart2
}
if otherValueEnd.Before(otherValueStart2) {
rightEnd = otherValueEnd
} else {
rightEnd = otherValueStart2
}
return (valueTime.After(leftStart) || valueTime.Equal(leftStart)) && (valueTime.Before(rightEnd) || valueTime.Equal(rightEnd))
} else if RelativeDateDirectionThis == direction2 {
return ((valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && (valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd))) ||
((valueTime.After(otherValueStart2) || valueTime.Equal(otherValueStart2)) && (valueTime.Before(otherValueEnd2) || valueTime.Equal(otherValueEnd2)))
} else if RelativeDateDirectionAfter == direction2 {
var leftStart, rightEnd time.Time
if otherValueStart.Before(otherValueStart2) {
leftStart = otherValueStart
@ -605,15 +621,12 @@ func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterO
rightEnd = otherValueEnd
}
return (valueTime.After(leftStart) || valueTime.Equal(leftStart)) && (valueTime.Before(rightEnd) || valueTime.Equal(rightEnd))
} else if RelativeDateDirectionThis == direction2 {
return ((valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && (valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd))) ||
((valueTime.After(otherValueStart2) || valueTime.Equal(otherValueStart2)) && (valueTime.Before(otherValueEnd2) || valueTime.Equal(otherValueEnd2)))
}
} else if RelativeDateDirectionThis == direction {
return ((valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && (valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd))) ||
((valueTime.After(otherValueStart2) || valueTime.Equal(otherValueStart2)) && (valueTime.Before(otherValueEnd2) || valueTime.Equal(otherValueEnd2)))
} else if RelativeDateDirectionAfter == direction {
if RelativeDateDirectionBefore == direction2 || RelativeDateDirectionAfter == direction2 {
if RelativeDateDirectionBefore == direction2 {
var leftStart, rightEnd time.Time
if otherValueStart.Before(otherValueStart2) {
leftStart = otherValueStart
@ -629,6 +642,19 @@ func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterO
} else if RelativeDateDirectionThis == direction2 {
return ((valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && (valueTime.Before(otherValueEnd) || valueTime.Equal(otherValueEnd))) ||
((valueTime.After(otherValueStart2) || valueTime.Equal(otherValueStart2)) && (valueTime.Before(otherValueEnd2) || valueTime.Equal(otherValueEnd2)))
} else if RelativeDateDirectionAfter == direction2 {
var leftStart, rightEnd time.Time
if otherValueEnd.Before(otherValueEnd2) {
leftStart = otherValueEnd
} else {
leftStart = otherValueEnd2
}
if otherValueEnd.After(otherValueEnd2) {
rightEnd = otherValueEnd
} else {
rightEnd = otherValueEnd2
}
return (valueTime.After(leftStart) || valueTime.Equal(leftStart)) && (valueTime.Before(rightEnd) || valueTime.Equal(rightEnd))
}
}
return false

View file

@ -554,8 +554,15 @@ func buildBlockBreadcrumb(node *ast.Node, excludeTypes []string, isEmbedBlock bo
name = util.UnescapeHTML(name)
name = util.EscapeHTML(name)
if !isEmbedBlock && parent == node {
name = ""
if !isEmbedBlock {
if parent == node {
name = ""
}
} else {
if ast.NodeDocument != parent.Type {
// 在嵌入块中隐藏最后一个非文档路径的面包屑中的文本 Hide text in breadcrumb of last non-document path in embed block https://github.com/siyuan-note/siyuan/issues/13866
name = ""
}
}
if add {

View file

@ -118,7 +118,7 @@ func ListInvalidBlockRefs(page, pageSize int) (ret []*Block, matchedBlockCount,
}
var toRemoves []string
for defID, _ := range invalidDefIDs {
for defID := range invalidDefIDs {
if _, ok := blockMap[defID]; ok {
toRemoves = append(toRemoves, defID)
}
@ -148,7 +148,7 @@ func ListInvalidBlockRefs(page, pageSize int) (ret []*Block, matchedBlockCount,
delete(refBlockMap, toRemove)
}
for refID, _ := range refBlockMap {
for refID := range refBlockMap {
invalidBlockIDs = append(invalidBlockIDs, refID)
}
invalidBlockIDs = gulu.Str.RemoveDuplicatedElem(invalidBlockIDs)
@ -596,6 +596,9 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
}
replaceNodeTokens(n, method, keyword, strings.TrimSpace(replacement), r)
if 1 > len(n.Tokens) {
unlinks = append(unlinks, n.Parent)
}
case ast.NodeLinkText:
if !replaceTypes["imgText"] {
return ast.WalkContinue
@ -683,6 +686,15 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
n.TextMarkAHref = r.ReplaceAllString(n.TextMarkAHref, strings.TrimSpace(replacement))
}
}
if "" == n.TextMarkAHref {
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
} else {
n.Type = ast.NodeText
n.Tokens = []byte(n.TextMarkTextContent)
}
}
}
} else if n.IsTextMarkType("em") {
if !replaceTypes["em"] {