From be5fa99b2cd8bd7db387095d554d0d63a4d018f8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 30 Nov 2023 12:16:33 +0800 Subject: [PATCH] :lipstick: fix https://github.com/siyuan-note/siyuan/issues/9788 --- app/src/assets/scss/business/_search.scss | 12 ++- app/src/dialog/tooltip.ts | 2 + app/src/search/assets.ts | 41 ++++---- app/src/search/menu.ts | 2 +- app/src/search/util.ts | 109 +++++++++++----------- 5 files changed, 88 insertions(+), 78 deletions(-) diff --git a/app/src/assets/scss/business/_search.scss b/app/src/assets/scss/business/_search.scss index 229b1b1d2..fff0089cf 100644 --- a/app/src/assets/scss/business/_search.scss +++ b/app/src/assets/scss/business/_search.scss @@ -5,10 +5,13 @@ min-height: 0.1px; flex-direction: column; + &:not(.search__layout--row) .search__list { + border-top: 1px solid var(--b3-theme-surface-lighter); + } + &--row { flex-direction: row; border-top: 1px solid var(--b3-theme-surface-lighter); - border-bottom: 1px solid var(--b3-theme-surface-lighter); .search__preview { border-top: 0; @@ -33,7 +36,8 @@ display: flex; background: var(--b3-theme-background); position: relative; - border-bottom: 1px solid var(--b3-theme-surface-lighter); + border-top: 1px solid var(--b3-theme-surface-lighter); + min-height: 42px; .block__icon { opacity: 1; @@ -114,6 +118,7 @@ flex: 1; overflow: auto; padding: 8px 0; + background-color: var(--b3-theme-background); .b3-list-item__text { user-select: none; @@ -144,12 +149,13 @@ &__tip { font-size: 12px; color: var(--b3-theme-on-surface-light); - margin: 2px 8px; + padding: 2px 8px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; line-height: 22px; + border-top: 1px solid var(--b3-theme-surface-lighter); kbd { &:first-child { diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index 6d84c774d..245011137 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -33,6 +33,8 @@ export const showTooltip = (message: string, target: Element, error = false) => if (position === "right") { // block icon left = targetRect.right - messageElement.clientWidth; + } else if (position?.endsWith("bottom")) { + top += parseInt(position); } else if (position === "parentE") { // file tree and outline态backlink top = parentRect.top; diff --git a/app/src/search/assets.ts b/app/src/search/assets.ts index 90679fd77..84c3e39ef 100644 --- a/app/src/search/assets.ts +++ b/app/src/search/assets.ts @@ -24,7 +24,23 @@ export const openSearchAsset = (element: Element, isStick: boolean) => { /// #if !BROWSER enterTip = `Enter/Double Click ${window.siyuan.languages.showInFolder}`; /// #endif - element.innerHTML = `
+ element.innerHTML = `
+ + + + + + + + + + + + + + +
+
@@ -32,36 +48,19 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
- + - + - + - - - - - - - -
-
- - - - - - - -
diff --git a/app/src/search/menu.ts b/app/src/search/menu.ts index 5d0f943fa..179d97d49 100644 --- a/app/src/search/menu.ts +++ b/app/src/search/menu.ts @@ -553,7 +553,7 @@ export const initCriteriaMenu = (element: HTMLElement, data: ISearchOption[], co - + `; /// #endif }); diff --git a/app/src/search/util.ts b/app/src/search/util.ts index f9250477a..2f14986fc 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -149,6 +149,39 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo }); const data = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS]; element.innerHTML = `
+
+ + + + + + + + + ${escapeHtml(config.hPath)} + + + + + + + + + + + + + + + + + + + + + + +
@@ -157,33 +190,31 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
- + - + - + - + - - - - - - - - - - - - - + +
+ + + + + + + + +
@@ -199,36 +230,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
-
-
- - - - - - - - - ${escapeHtml(config.hPath)} - - - - - - - - -
- - - - - - - - -
-
+
@@ -429,7 +431,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo searchPathInputElement.setAttribute("aria-label", ""); inputEvent(element, config, edit, true); const includeElement = element.querySelector("#searchInclude"); - includeElement.classList.remove("b3-button--cancel"); + includeElement.firstElementChild.classList.add("ft__primary"); includeElement.setAttribute("disabled", "disabled"); event.stopPropagation(); event.preventDefault(); @@ -477,7 +479,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo searchPathInputElement.innerHTML = `${escapeHtml(config.hPath)}`; searchPathInputElement.setAttribute("aria-label", escapeHtml(config.hPath)); const includeElement = element.querySelector("#searchInclude"); - includeElement.classList.remove("b3-button--cancel"); + includeElement.firstElementChild.classList.add("ft__primary"); if (enableIncludeChild) { includeElement.removeAttribute("disabled"); } else { @@ -490,8 +492,9 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo event.preventDefault(); break; } else if (target.id === "searchInclude") { - target.classList.toggle("b3-button--cancel"); - if (target.classList.contains("b3-button--cancel")) { + const svgElement = target.firstElementChild + svgElement.classList.toggle("ft__primary"); + if (!svgElement.classList.contains("ft__primary")) { config.idPath.forEach((item, index) => { if (!item.endsWith(".sy") && item.split("/").length > 1) { config.idPath[index] = item + ".sy"; @@ -934,9 +937,9 @@ const updateConfig = (element: Element, item: ISearchOption, config: ISearchOpti }); const searchIncludeElement = element.querySelector("#searchInclude"); if (includeChild) { - searchIncludeElement.classList.remove("b3-button--cancel"); + searchIncludeElement.firstElementChild.classList.add("ft__primary"); } else { - searchIncludeElement.classList.add("b3-button--cancel"); + searchIncludeElement.firstElementChild.classList.remove("ft__primary"); } if (enableIncludeChild) { searchIncludeElement.removeAttribute("disabled");