mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6a36b7a051
2 changed files with 28 additions and 23 deletions
|
|
@ -657,17 +657,17 @@ export abstract class Constants {
|
|||
"text": true,
|
||||
"imgText": true,
|
||||
"imgTitle": true,
|
||||
"imgSrc": false,
|
||||
"imgSrc": true,
|
||||
"aText": true,
|
||||
"aTitle": true,
|
||||
"aHref": false,
|
||||
"code": false,
|
||||
"aHref": true,
|
||||
"code": true,
|
||||
"em": true,
|
||||
"strong": true,
|
||||
"inlineMath": false,
|
||||
"inlineMath": true,
|
||||
"inlineMemo": true,
|
||||
"blockRef": false,
|
||||
"fileAnnotationRef": false,
|
||||
"blockRef": true,
|
||||
"fileAnnotationRef": true,
|
||||
"kbd": true,
|
||||
"mark": true,
|
||||
"s": true,
|
||||
|
|
@ -676,9 +676,9 @@ export abstract class Constants {
|
|||
"tag": true,
|
||||
"u": true,
|
||||
"docTitle": true,
|
||||
"codeBlock": false,
|
||||
"mathBlock": false,
|
||||
"htmlBlock": false
|
||||
"codeBlock": true,
|
||||
"mathBlock": true,
|
||||
"htmlBlock": true
|
||||
};
|
||||
|
||||
// image
|
||||
|
|
|
|||
|
|
@ -790,12 +790,18 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||
if 0 == method {
|
||||
if strings.Contains(n.TextMarkInlineMemoContent, keyword) {
|
||||
n.TextMarkInlineMemoContent = strings.ReplaceAll(n.TextMarkInlineMemoContent, keyword, replacement)
|
||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||
}
|
||||
} else if 3 == method {
|
||||
if nil != r && r.MatchString(n.TextMarkInlineMemoContent) {
|
||||
n.TextMarkInlineMemoContent = r.ReplaceAllString(n.TextMarkInlineMemoContent, replacement)
|
||||
n.TextMarkTextContent = r.ReplaceAllString(n.TextMarkTextContent, replacement)
|
||||
}
|
||||
}
|
||||
|
||||
if "" == n.TextMarkTextContent {
|
||||
unlinks = append(unlinks, n)
|
||||
}
|
||||
} else if n.IsTextMarkType("text") {
|
||||
// Search and replace fails in some cases https://github.com/siyuan-note/siyuan/issues/10016
|
||||
if !replaceTypes["text"] {
|
||||
|
|
@ -988,11 +994,6 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
|
|||
}
|
||||
|
||||
query = filterQueryInvisibleChars(query)
|
||||
trimQuery := strings.TrimSpace(query)
|
||||
if "" != trimQuery {
|
||||
query = trimQuery
|
||||
}
|
||||
|
||||
var ignoreFilter string
|
||||
if ignoreLines := getSearchIgnoreLines(); 0 < len(ignoreLines) {
|
||||
// Support ignore search results https://github.com/siyuan-note/siyuan/issues/10089
|
||||
|
|
@ -1755,22 +1756,26 @@ func columnConcat() string {
|
|||
}
|
||||
|
||||
func stringQuery(query string) string {
|
||||
if "" == strings.TrimSpace(query) {
|
||||
trimmedQuery := strings.TrimSpace(query)
|
||||
if "" == trimmedQuery {
|
||||
return "\"" + query + "\""
|
||||
}
|
||||
|
||||
query = strings.ReplaceAll(query, "\"", "\"\"")
|
||||
query = strings.ReplaceAll(query, "'", "''")
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
parts := strings.Split(query, " ")
|
||||
for _, part := range parts {
|
||||
part = strings.TrimSpace(part)
|
||||
part = "\"" + part + "\""
|
||||
buf.WriteString(part)
|
||||
buf.WriteString(" ")
|
||||
if strings.Contains(trimmedQuery, " ") {
|
||||
buf := bytes.Buffer{}
|
||||
parts := strings.Split(query, " ")
|
||||
for _, part := range parts {
|
||||
part = strings.TrimSpace(part)
|
||||
part = "\"" + part + "\""
|
||||
buf.WriteString(part)
|
||||
buf.WriteString(" ")
|
||||
}
|
||||
return strings.TrimSpace(buf.String())
|
||||
}
|
||||
return strings.TrimSpace(buf.String())
|
||||
return "\"" + query + "\""
|
||||
}
|
||||
|
||||
// markReplaceSpan 用于处理搜索高亮。
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue