Skip to content

Commit

Permalink
🎨 Find replace supports selecting element types #9895
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 17, 2023
1 parent ef6598e commit af53d6a
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 26 deletions.
25 changes: 25 additions & 0 deletions app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"replaceTypes": {
"text": "Normal text",
"imgText": "Image alt text",
"imgTitle": "Image title",
"imgSrc": "Image link",
"aText": "Link anchor text",
"aTitle": "Link title",
"aHref": "Link link",
"code": "inline code",
"em": "Italic",
"strong": "Bold",
"inlineMath": "Inline formula",
"inlineMemo": "Inline memo",
"kbd": "Keyboard",
"mark": "Mark",
"s": "Strikethrough",
"sub": "Subscript",
"sup": "Superscript",
"tag": "Tag",
"u": "Underline",
"docTitle": "Document title",
"codeBlock": "Code block",
"mathBlock": "Formula block",
"htmlBlock": "HTML block"
},
"selected": "Selected",
"loadMore": "Load more",
"tempUnlock": "Temporarily unlock",
Expand Down
25 changes: 25 additions & 0 deletions app/appearance/langs/es_ES.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"replaceTypes": {
"text": "Texto normal",
"imgText": "Texto alternativo de la imagen",
"imgTitle": "Título de la imagen",
"imgSrc": "Enlace de imagen",
"aText": "Texto ancla del enlace",
"aTitle": "Título del enlace",
"aHref": "Enlace enlace",
"code": "código en línea",
"em": "Cursiva",
"strong": "negrita",
"inlineMath": "Fórmula en línea",
"inlineMemo": "Nota en línea",
"kbd": "Teclado",
"mark": "Marca",
"s": "Tachado",
"sub": "Subíndice",
"sup": "Superíndice",
"tag": "Etiqueta",
"u": "Subrayado",
"docTitle": "Título del documento",
"codeBlock": "Bloque de código",
"mathBlock": "Bloque de fórmulas",
"htmlBlock": "bloque HTML"
},
"selected": "Seleccionado",
"loadMore": "Cargar más",
"tempUnlock": "Desbloquear temporalmente",
Expand Down
25 changes: 25 additions & 0 deletions app/appearance/langs/fr_FR.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"replaceTypes": {
"text": "Texte normal",
"imgText": "Texte alternatif de l'image",
"imgTitle": "Titre de l'image",
"imgSrc": "Lien image",
"aText": "Texte d'ancrage du lien",
"aTitle": "Titre du lien",
"aHref": "Lien lien",
"code": "code en ligne",
"em": "Italique",
"strong": "Audacieux",
"inlineMath": "Formule en ligne",
"inlineMemo": "Mémo en ligne",
"kbd": "Clavier",
"mark": "Marquer",
"s": "Barré",
"sub": "Indice",
"sup": "Exposant",
"tag": "balise",
"u": "Souligner",
"docTitle": "Titre du document",
"codeBlock": "Bloc de code",
"mathBlock": "Bloc de formule",
"htmlBlock": "Bloc HTML"
},
"selected": "Sélectionné",
"loadMore": "Charger plus",
"tempUnlock": "Déverrouiller temporairement",
Expand Down
25 changes: 25 additions & 0 deletions app/appearance/langs/zh_CHT.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"replaceTypes": {
"text": "普通文字",
"imgText": "圖片提示文字",
"imgTitle": "圖片標題",
"imgSrc": "圖片連結",
"aText": "連結錨文本",
"aTitle": "連結標題",
"aHref": "連結位址",
"code": "行級代碼",
"em": "斜體",
"strong": "粗體",
"inlineMath": "行級公式",
"inlineMemo": "行級備註",
"kbd": "鍵盤",
"mark": "高亮",
"s": "刪除",
"sub": "下標",
"sup": "上標",
"tag": "標籤",
"u": "底線",
"docTitle": "文檔標題",
"codeBlock": "程式碼區塊",
"mathBlock": "公式區塊",
"htmlBlock": "HTML 區塊"
},
"selected": "已選擇",
"loadMore": "載入更多",
"tempUnlock": "暫時解鎖",
Expand Down
25 changes: 25 additions & 0 deletions app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"replaceTypes": {
"text": "普通文本",
"imgText": "图片提示文本",
"imgTitle": "图片标题",
"imgSrc": "图片链接",
"aText": "链接锚文本",
"aTitle": "链接标题",
"aHref": "链接地址",
"code": "行级代码",
"em": "斜体",
"strong": "粗体",
"inlineMath": "行级公式",
"inlineMemo": "行级备注",
"kbd": "键盘",
"mark": "高亮",
"s": "删除",
"sub": "下标",
"sup": "上标",
"tag": "标签",
"u": "下划线",
"docTitle": "文档标题",
"codeBlock": "代码块",
"mathBlock": "公式块",
"htmlBlock": "HTML 块"
},
"selected": "已选中",
"loadMore": "加载更多",
"tempUnlock": "临时解锁",
Expand Down
26 changes: 13 additions & 13 deletions app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,29 +521,29 @@ export abstract class Constants {
[key: string]: boolean;
} = {
"text": true,
"img-text": true,
"img-title": true,
"img-src": false,
"a-text": true,
"a-title": true,
"a-href": false,
"imgText": true,
"imgTitle": true,
"imgSrc": false,
"aText": true,
"aTitle": true,
"aHref": false,
"code": false,
"em": true,
"strong": true,
"inline-math": false,
"inline-memo": true,
"inlineMath": false,
"inlineMemo": true,
"kbd": true,
"mark": true,
"s": true,
"sub": true,
"sup": true,
"tag": true,
"u": true,
"doc-title": true,
"code-block": false,
"math-block": false,
"html-block": false
};
"docTitle": true,
"codeBlock": false,
"mathBlock": false,
"htmlBlock": false
}

// image
public static readonly SIYUAN_IMAGE_VIP: string = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
Expand Down
2 changes: 1 addition & 1 deletion app/src/search/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const replaceFilterMenu = (config: ISearchOption) => {
html += `<label class="fn__flex b3-label">
<span class="fn__space"></span>
<div class="fn__flex-1 fn__flex-center">
${window.siyuan.languages[key]}
${window.siyuan.languages.replaceTypes[key]}
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" data-type="${key}" type="checkbox"${config.replaceTypes[key] ? " checked" : ""}>
Expand Down
24 changes: 12 additions & 12 deletions kernel/model/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,28 +190,28 @@ type CriterionTypes struct {

type CriterionReplaceTypes struct {
Text bool `json:"text"`
ImgText bool `json:"img-text"`
ImgTitle bool `json:"img-title"`
ImgSrc bool `json:"img-src"`
AText bool `json:"a-text"`
ATitle bool `json:"a-title"`
AHref bool `json:"a-href"`
ImgText bool `json:"imgText"`
ImgTitle bool `json:"imgTitle"`
ImgSrc bool `json:"imgSrc"`
AText bool `json:"aText"`
ATitle bool `json:"aTitle"`
AHref bool `json:"aHref"`
Code bool `json:"code"`
Em bool `json:"em"`
Strong bool `json:"strong"`
InlineMath bool `json:"inline-math"`
InlineMemo bool `json:"inline-memo"`
InlineMath bool `json:"inlineMath"`
InlineMemo bool `json:"inlineMemo"`
Kbd bool `json:"kbd"`
Mark bool `json:"mark"`
S bool `json:"s"`
Sub bool `json:"sub"`
Sup bool `json:"sup"`
Tag bool `json:"tag"`
U bool `json:"u"`
DocTitle bool `json:"doc-title"`
CodeBlock bool `json:"code-block"`
MathBlock bool `json:"math-block"`
HtmlBlock bool `json:"html-block"`
DocTitle bool `json:"docTitle"`
CodeBlock bool `json:"codeBlock"`
MathBlock bool `json:"mathBlock"`
HtmlBlock bool `json:"htmlBlock"`
}

var criteriaLock = sync.Mutex{}
Expand Down

0 comments on commit af53d6a

Please sign in to comment.