From ca891b6440f8d0a2f9b315efd83ca6c4a05bc55b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 13 Jul 2023 23:18:09 +0800 Subject: [PATCH] :rotating_light: --- app/src/protyle/render/av/filter.ts | 38 ++++++++++++++--------------- app/src/protyle/render/av/select.ts | 8 +++--- app/src/search/util.ts | 10 ++++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index f2251c5c1..be0e6352e 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -55,20 +55,20 @@ export const genCellValue = (colType: TAVCol, value: string | { }; const toggleEmpty = (element: HTMLElement, show: boolean) => { - const menuElement = hasClosestByClassName(element, "b3-menu") + const menuElement = hasClosestByClassName(element, "b3-menu"); if (menuElement) { menuElement.querySelectorAll("input, .b3-chip").forEach(inputElement => { - const menuItemElement = hasClosestByClassName(inputElement, "b3-menu__item") + const menuItemElement = hasClosestByClassName(inputElement, "b3-menu__item"); if (menuItemElement) { if (show) { - menuItemElement.classList.remove("fn__none") + menuItemElement.classList.remove("fn__none"); } else { - menuItemElement.classList.add("fn__none") + menuItemElement.classList.add("fn__none"); } } - }) + }); } -} +}; export const setFilter = (options: { filter: IAVFilter, @@ -84,16 +84,16 @@ export const setFilter = (options: { if (textElement) { cellValue = genCellValue(options.filter.value.type, textElement.value); } else { - const mSelect: { color: string, content: string }[] = [] - window.siyuan.menus.menu.element.querySelectorAll('svg').forEach(item => { + const mSelect: { color: string, content: string }[] = []; + window.siyuan.menus.menu.element.querySelectorAll("svg").forEach(item => { if (item.firstElementChild.getAttribute("xlink:href") === "#iconCheck") { - const chipElement = item.nextElementSibling.firstElementChild as HTMLElement + const chipElement = item.nextElementSibling.firstElementChild as HTMLElement; mSelect.push({ color: chipElement.dataset.color, content: chipElement.dataset.name - }) + }); } - }) + }); cellValue = genCellValue(options.filter.value.type, mSelect); } const newFilter: IAVFilter = { @@ -188,12 +188,12 @@ export const setFilter = (options: { }); if (options.filter.value.type === "select" || options.filter.value.type === "mSelect") { colData.options?.forEach((option) => { - let icon = "iconUncheck" + let icon = "iconUncheck"; options.filter.value.mSelect.find((optionItem) => { if (optionItem.content === option.name) { - icon = "iconCheck" + icon = "iconCheck"; } - }) + }); menu.addItem({ icon, label: ` @@ -201,15 +201,15 @@ export const setFilter = (options: { `, bind(element) { element.addEventListener("click", () => { - const useElement = element.querySelector("use") + const useElement = element.querySelector("use"); if (useElement.getAttribute("xlink:href") === "#iconUncheck") { useElement.setAttribute("xlink:href", "#iconCheck"); } else { useElement.setAttribute("xlink:href", "#iconUncheck"); } - }) + }); } - }) + }); }); } else if (options.filter.value.type === "text") { menu.addItem({ @@ -250,7 +250,7 @@ export const setFilter = (options: { }); const selectElement = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement); selectElement.addEventListener("change", () => { - toggleEmpty(selectElement, selectElement.value !== "Is empty" && selectElement.value !== "Is not empty") + toggleEmpty(selectElement, selectElement.value !== "Is empty" && selectElement.value !== "Is not empty"); }); const textElement = window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement; if (textElement) { @@ -265,7 +265,7 @@ export const setFilter = (options: { } }); } - toggleEmpty(selectElement, selectElement.value !== "Is empty" && selectElement.value !== "Is not empty") + toggleEmpty(selectElement, selectElement.value !== "Is empty" && selectElement.value !== "Is not empty"); menu.open({x: rectTarget.left, y: rectTarget.bottom}); if (textElement) { textElement.select(); diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index 1d68958ad..3d7511bfe 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -388,15 +388,15 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: { id: Lute.NewNodeID(), value: genCellValue(colData.type, ""), valueType: colData.type - } + }; } else { - let hasSelected = false + let hasSelected = false; cellData.value.mSelect.find((item) => { if (item.content === currentElement.dataset.name) { - hasSelected = true + hasSelected = true; return true; } - }) + }); if (hasSelected) { menuElement.querySelector("input").focus(); return; diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 4aa844dd8..d94d214ce 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -13,7 +13,7 @@ import {addLoading, setPadding} from "../protyle/ui/initUI"; import {getIconByType} from "../editor/getIcon"; import {unicode2Emoji} from "../emoji"; import {hasClosestByClassName} from "../protyle/util/hasClosest"; -import {isCtrl, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility"; +import {setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility"; import {newFileByName} from "../util/newFile"; import {matchHotKey} from "../protyle/util/hotKey"; import {filterMenu, getKeyByLiElement, initCriteriaMenu, moreMenu, queryMenu, saveCriterion} from "./menu"; @@ -294,7 +294,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo paragraph: window.siyuan.config.search.paragraph, embedBlock: window.siyuan.config.search.embedBlock, } - }, config, edit, app); + }, config, edit); event.stopPropagation(); event.preventDefault(); break; @@ -323,7 +323,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo config.removed = false; criteriaData.find(item => { if (item.name === target.innerText.trim()) { - updateConfig(element, item, config, edit, app); + updateConfig(element, item, config, edit); return true; } }); @@ -483,7 +483,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo paragraph: window.siyuan.config.search.paragraph, embedBlock: window.siyuan.config.search.embedBlock, } - }, config, edit, app); + }, config, edit); }, () => { const localData = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS]; const isPopover = hasClosestByClassName(element, "b3-dialog__container"); @@ -855,7 +855,7 @@ const getQueryTip = (method: number) => { return methodTip; }; -const updateConfig = (element: Element, item: ISearchOption, config: ISearchOption, edit: Protyle, app: App) => { +const updateConfig = (element: Element, item: ISearchOption, config: ISearchOption, edit: Protyle) => { const dialogElement = hasClosestByClassName(element, "b3-dialog--open"); if (dialogElement && dialogElement.getAttribute("data-key") === window.siyuan.config.keymap.general.search.custom) { // https://github.com/siyuan-note/siyuan/issues/6828