🎨 Support find replace block ref anchor text https://github.com/siyuan-note/siyuan/issues/11978
This commit is contained in:
parent
6fc0e43b77
commit
8bf6646514
9 changed files with 28 additions and 0 deletions
|
@ -112,6 +112,7 @@
|
|||
"strong": "Bold",
|
||||
"inlineMath": "Inline formula",
|
||||
"inlineMemo": "Inline memo",
|
||||
"blockRef": "Ref anchor text",
|
||||
"kbd": "Keyboard",
|
||||
"mark": "Mark",
|
||||
"s": "Strikethrough",
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
"strong": "negrita",
|
||||
"inlineMath": "Fórmula en línea",
|
||||
"inlineMemo": "Nota en línea",
|
||||
"blockRef": "texto de anclaje de referencia",
|
||||
"kbd": "Teclado",
|
||||
"mark": "Marca",
|
||||
"s": "Tachado",
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
"strong": "Audacieux",
|
||||
"inlineMath": "Formule en ligne",
|
||||
"inlineMemo": "Mémo en ligne",
|
||||
"blockRef": "texte d'ancrage de référence",
|
||||
"kbd": "Clavier",
|
||||
"mark": "Marquer",
|
||||
"s": "Barré",
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
"strong": "太字",
|
||||
"inlineMath": "インライン数式",
|
||||
"inlineMemo": "インラインメモ",
|
||||
"blockRef": "アンカー テキストを引用する",
|
||||
"kbd": "キーボード",
|
||||
"mark": "ハイライト",
|
||||
"s": "取り消し線",
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
"strong": "粗體",
|
||||
"inlineMath": "行級公式",
|
||||
"inlineMemo": "行級備註",
|
||||
"blockRef": "引用錨文本",
|
||||
"kbd": "鍵盤",
|
||||
"mark": "高亮",
|
||||
"s": "刪除",
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
"strong": "粗体",
|
||||
"inlineMath": "行级公式",
|
||||
"inlineMemo": "行级备注",
|
||||
"blockRef": "引用锚文本",
|
||||
"kbd": "键盘",
|
||||
"mark": "高亮",
|
||||
"s": "删除",
|
||||
|
|
|
@ -612,6 +612,7 @@ export abstract class Constants {
|
|||
"strong": true,
|
||||
"inlineMath": false,
|
||||
"inlineMemo": true,
|
||||
"blockRef": false,
|
||||
"kbd": true,
|
||||
"mark": true,
|
||||
"s": true,
|
||||
|
|
5
app/src/types/config.d.ts
vendored
5
app/src/types/config.d.ts
vendored
|
@ -2105,6 +2105,11 @@ declare namespace Config {
|
|||
* @default true
|
||||
*/
|
||||
inlineMemo?: boolean;
|
||||
/**
|
||||
* Replace block refs
|
||||
* @default false
|
||||
*/
|
||||
blockRef?: boolean;
|
||||
/**
|
||||
* Replace kdb elements
|
||||
* @default true
|
||||
|
|
|
@ -747,6 +747,22 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||
}
|
||||
|
||||
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "text")
|
||||
} else if n.IsTextMarkType("block-ref") {
|
||||
if !replaceTypes["blockRef"] {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if 0 == method {
|
||||
if strings.Contains(n.TextMarkTextContent, keyword) {
|
||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||
n.TextMarkBlockRefSubtype = "s"
|
||||
}
|
||||
} else if 3 == method {
|
||||
if nil != r && r.MatchString(n.TextMarkTextContent) {
|
||||
n.TextMarkTextContent = r.ReplaceAllString(n.TextMarkTextContent, replacement)
|
||||
n.TextMarkBlockRefSubtype = "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
|
|
Loading…
Add table
Reference in a new issue