From 0dcac1e52f26da74433917ff40385f0c60831e80 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 28 Nov 2022 11:39:18 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/6731 --- app/src/search/util.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 1814836b1..b00e79bb4 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -77,6 +77,14 @@ export const openGlobalSearch = (text: string, replace: boolean) => { }; export const genSearch = (config: ISearchOption, element: Element, closeCB?: () => void) => { + let methodText = window.siyuan.languages.text; + if (config.method === 1) { + methodText = window.siyuan.languages.querySyntax + }else if (config.method === 2) { + methodText = "SQL" + }else if (config.method === 3) { + methodText = window.siyuan.languages.regex + } element.innerHTML = `
@@ -90,7 +98,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: () - + @@ -132,11 +140,9 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: () -
- - - -
+ + +
@@ -518,11 +524,13 @@ const addConfigMenu = (config: ISearchOption, lang: string, key: "mathBlock" | " }; const addQueryMenu = (config: ISearchOption, edit: Protyle, element: Element) => { + const searchSyntaxCheckElement = element.querySelector("#searchSyntaxCheck") window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.text, current: config.method === 0, click() { config.method = 0; + searchSyntaxCheckElement.setAttribute("aria-label", `${window.siyuan.languages.searchMethod} ${window.siyuan.languages.text}`); inputEvent(element, config, undefined, edit); } }).element); @@ -531,6 +539,7 @@ const addQueryMenu = (config: ISearchOption, edit: Protyle, element: Element) => current: config.method === 1, click() { config.method = 1; + searchSyntaxCheckElement.setAttribute("aria-label", `${window.siyuan.languages.searchMethod} ${window.siyuan.languages.querySyntax}`); inputEvent(element, config, undefined, edit); } }).element); @@ -539,6 +548,7 @@ const addQueryMenu = (config: ISearchOption, edit: Protyle, element: Element) => current: config.method === 2, click() { config.method = 2; + searchSyntaxCheckElement.setAttribute("aria-label", `${window.siyuan.languages.searchMethod} SQL`); inputEvent(element, config, undefined, edit); } }).element); @@ -547,6 +557,7 @@ const addQueryMenu = (config: ISearchOption, edit: Protyle, element: Element) => current: config.method === 3, click() { config.method = 3; + searchSyntaxCheckElement.setAttribute("aria-label", `${window.siyuan.languages.searchMethod} ${window.siyuan.languages.regex}`); inputEvent(element, config, undefined, edit); } }).element);