Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/11098

Vanessacbfee5abe055
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 2835cc727e..afc1760c34 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -85,13 +85,13 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
return true;
}
- /// #if !MOBILE
const searchIconElement = hasClosestByAttribute(event.target, "data-type", "av-search-icon");
if (searchIconElement) {
const searchElement = blockElement.querySelector('input[data-type="av-search"]') as HTMLInputElement;
searchElement.style.width = "128px";
searchElement.style.paddingLeft = "";
searchElement.style.paddingRight = "";
+ searchElement.value = " ";
setTimeout(() => {
searchElement.focus();
}, Constants.TIMEOUT_TRANSITION);
@@ -99,7 +99,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation();
return true;
}
- /// #endif
const viewItemElement = hasClosestByClassName(event.target, "item");
if (viewItemElement && viewItemElement.parentElement.classList.contains("layout-tab-bar")) {
if (viewItemElement.classList.contains("item--focus")) {
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index b653e72f18..3f89603c0c 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -55,7 +55,7 @@ export const openMenuPanel = (options: {
const avID = options.blockElement.getAttribute("data-av-id");
fetchPost("/api/av/renderAttributeView", {
id: avID,
- query: (options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value || "",
+ query: (options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "",
pageSize: parseInt(options.blockElement.getAttribute("data-page-size")) || undefined,
viewID: options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)
}, (response) => {
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index f50ad1a8f3..fa9a8acba1 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -10,7 +10,6 @@ import {getCalcValue} from "./calc";
import {renderAVAttribute} from "./blockAttr";
import {showMessage} from "../../../dialog/message";
import {addClearButton} from "../../../util/addClearButton";
-import {isMobile} from "../../../util/functions";
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, viewID?: string) => {
let avElements: Element[] = [];
@@ -84,7 +83,7 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
snapshot,
pageSize: parseInt(e.dataset.pageSize) || undefined,
viewID: newViewID,
- query
+ query: query.trim()
}, (response) => {
const data = response.data.view as IAVTable;
if (!e.dataset.pageSize) {
@@ -236,11 +235,11 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
<svg><use xlink:href="#iconSort"></use></svg>
</span>
<div class="fn__space"></div>
- <span data-type="av-search-icon" class="block__icon${isMobile() ? " fn__none" : ""}">
+ <span data-type="av-search-icon" class="block__icon">
<svg><use xlink:href="#iconSearch"></use></svg>
</span>
<div style="position: relative" class="fn__flex">
- <input style="${(isSearching || query || isMobile()) ? "width:128px" : "width:0;padding-left: 0;padding-right: 0;"}" data-type="av-search" class="b3-text-field b3-text-field--text" placeholder="${window.siyuan.languages.search}">
+ <input style="${isSearching || query ? "width:128px" : "width:0;padding-left: 0;padding-right: 0;"}" data-type="av-search" class="b3-text-field b3-text-field--text" placeholder="${window.siyuan.languages.search}">
</div>
<div class="fn__space"></div>
<span data-type="av-more" class="block__icon">
@@ -348,7 +347,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
}
const viewsElement = e.querySelector(".av__views") as HTMLElement;
searchInputElement = e.querySelector('[data-type="av-search"]') as HTMLInputElement;
- searchInputElement.value = query;
+ searchInputElement.value = query || "";
if (isSearching) {
searchInputElement.focus();
}
@@ -366,7 +365,6 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
searchInputElement.addEventListener("compositionend", () => {
updateSearch(e, protyle);
});
- /// #if !MOBILE
searchInputElement.addEventListener("blur", (event: KeyboardEvent) => {
if (event.isComposing) {
return;
@@ -378,7 +376,6 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
searchInputElement.style.paddingRight = "0";
}
});
- /// #endif
addClearButton({
inputElement: searchInputElement,
right: 0,
@@ -386,11 +383,9 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
height: searchInputElement.clientHeight,
clearCB() {
viewsElement.classList.remove("av__views--show");
- /// #if !MOBILE
searchInputElement.style.width = "0";
searchInputElement.style.paddingLeft = "0";
searchInputElement.style.paddingRight = "0";
- /// #endif
focusBlock(e);
updateSearch(e, protyle);
}