Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17871

Daniel5625bea23683
diff --git a/app/src/protyle/render/av/gallery/render.ts b/app/src/protyle/render/av/gallery/render.ts
index 757cd24c92..b3603b406d 100644
--- a/app/src/protyle/render/av/gallery/render.ts
+++ b/app/src/protyle/render/av/gallery/render.ts
@@ -189,11 +189,15 @@ export const afterRenderGallery = (options: ITableOptions) => {
if (event.isComposing) {
return;
}
- if (!searchInputElement.textContent) {
+ if (!searchInputElement.textContent.trim()) {
viewsElement.classList.remove("av__views--show");
searchInputElement.style.width = "0";
searchInputElement.style.paddingLeft = "0";
- searchInputElement.style.marginRight = "0";
+ searchInputElement.style.setProperty("margin-right", "0", "important");
+ const clearElement = searchInputElement.nextElementSibling;
+ if (clearElement) {
+ clearElement.classList.add("fn__none");
+ }
}
});
addClearButton({
@@ -205,7 +209,7 @@ export const afterRenderGallery = (options: ITableOptions) => {
viewsElement.classList.remove("av__views--show");
searchInputElement.style.width = "0";
searchInputElement.style.paddingLeft = "0";
- searchInputElement.style.marginRight = "0";
+ searchInputElement.style.setProperty("margin-right", "0", "important");
focusBlock(options.blockElement);
updateSearch(options.blockElement, options.protyle);
/// #if MOBILE
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 50fc515852..b07cda77e0 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -418,11 +418,15 @@ const afterRenderTable = (options: ITableOptions) => {
if (event.isComposing) {
return;
}
- if (!searchInputElement.textContent) {
+ if (!searchInputElement.textContent.trim()) {
viewsElement.classList.remove("av__views--show");
searchInputElement.style.width = "0";
searchInputElement.style.paddingLeft = "0";
- searchInputElement.style.marginRight = "0";
+ searchInputElement.style.setProperty("margin-right", "0", "important");
+ const clearElement = searchInputElement.nextElementSibling;
+ if (clearElement) {
+ clearElement.classList.add("fn__none");
+ }
}
});
addClearButton({
@@ -434,7 +438,7 @@ const afterRenderTable = (options: ITableOptions) => {
viewsElement.classList.remove("av__views--show");
searchInputElement.style.width = "0";
searchInputElement.style.paddingLeft = "0";
- searchInputElement.style.marginRight = "0";
+ searchInputElement.style.setProperty("margin-right", "0", "important");
focusBlock(options.blockElement);
updateSearch(options.blockElement, options.protyle);
/// #if MOBILE
diff --git a/app/src/util/addClearButton.ts b/app/src/util/addClearButton.ts
index c9d1752594..382d0eb799 100644
--- a/app/src/util/addClearButton.ts
+++ b/app/src/util/addClearButton.ts
@@ -1,7 +1,7 @@
const update = (inputElement: HTMLElement, clearElement: Element, right: number) => {
let value = "";
if (inputElement.tagName === "DIV") {
- value = inputElement.textContent;
+ value = inputElement.textContent.trim();
} else {
value = (inputElement as HTMLInputElement).value;
}
@@ -10,6 +10,9 @@ const update = (inputElement: HTMLElement, clearElement: Element, right: number)
clearElement.classList.add("fn__none");
if (typeof right === "number") {
inputElement.style.paddingRight = inputElement.dataset.oldPaddingRight;
+ if (inputElement.getAttribute("contenteditable")) {
+ inputElement.style.removeProperty("margin-right");
+ }
}
} else {
clearElement.classList.remove("fn__none");