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/12335

Vanessab8fda7d67ff4
diff --git a/app/src/search/toggleHistory.ts b/app/src/search/toggleHistory.ts
index 3f2be4597b..87b4c61ef2 100644
--- a/app/src/search/toggleHistory.ts
+++ b/app/src/search/toggleHistory.ts
@@ -13,7 +13,7 @@ import {inputEvent} from "./util";
export const toggleReplaceHistory = (replaceInputElement: HTMLInputElement) => {
const list = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS];
- if (!list.replaceKeys || list.replaceKeys.length === 0) {
+ if (!list.replaceKeys || list.replaceKeys.length === 0 || (list.length === 1 && list[0] === replaceInputElement.value)) {
return;
}
const menu = new Menu("search-replace-history");
@@ -79,8 +79,9 @@ export const toggleReplaceHistory = (replaceInputElement: HTMLInputElement) => {
};
export const toggleSearchHistory = (searchElement: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle) => {
+ const searchInputElement = searchElement.querySelector("#searchInput, #toolbarSearch") as HTMLInputElement;
const list = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS];
- if (!list.keys || list.keys.length === 0) {
+ if (!list.keys || list.keys.length === 0 || (list.length === 1 && list[0] === searchInputElement.value)) {
return;
}
const menu = new Menu("search-history");
@@ -98,7 +99,6 @@ export const toggleSearchHistory = (searchElement: Element, config: Config.IUILa
});
const separatorElement = menu.addSeparator(1);
let current = true;
- const searchInputElement = searchElement.querySelector("#searchInput, #toolbarSearch") as HTMLInputElement;
list.keys.forEach((s: string) => {
if (s !== searchInputElement.value && s) {
const menuItem = menu.addItem({
@@ -153,8 +153,9 @@ export const toggleSearchHistory = (searchElement: Element, config: Config.IUILa
};
export const toggleAssetHistory = (assetElement: Element) => {
+ const assetInputElement = assetElement.querySelector("#searchAssetInput") as HTMLInputElement;
const keys = window.siyuan.storage[Constants.LOCAL_SEARCHASSET].keys;
- if (!keys || keys.length === 0) {
+ if (!keys || keys.length === 0 || (keys.length === 1 && keys[0] === assetInputElement.value)) {
return;
}
const menu = new Menu("search-asset-history");
@@ -172,7 +173,6 @@ export const toggleAssetHistory = (assetElement: Element) => {
});
const separatorElement = menu.addSeparator(1);
let current = true;
- const assetInputElement = assetElement.querySelector("#searchAssetInput") as HTMLInputElement;
keys.forEach((s: string) => {
if (s !== assetInputElement.value && s) {
const menuItem = menu.addItem({
@@ -233,7 +233,7 @@ export const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
setStorageVal(Constants.LOCAL_SEARCHKEYS, window.siyuan.storage[Constants.LOCAL_SEARCHKEYS]);
};
-export const saveAssetKeyList = (inputElement:HTMLInputElement) => {
+export const saveAssetKeyList = (inputElement: HTMLInputElement) => {
if (!inputElement.value) {
return;
}
diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts
index 0ae01d3597..95eabaaa87 100644
--- a/app/src/util/pathName.ts
+++ b/app/src/util/pathName.ts
@@ -154,8 +154,10 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
return;
}
const dialog = new Dialog({
- title: `${title || window.siyuan.languages.move}
-<div style="max-height: 16px;overflow: auto;line-height: 14px;-webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0, #000 6px);padding-bottom: 4px;margin-bottom: -4px" class="ft__smaller ft__on-surface fn__hidescrollbar"></div>`,
+ title: `<div style="padding: 8px;">
+ ${title || window.siyuan.languages.move}
+ <div style="max-height: 16px;overflow: auto;line-height: 14px;-webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0, #000 6px);padding-bottom: 4px;margin-bottom: -4px" class="ft__smaller ft__on-surface fn__hidescrollbar"></div>
+</div>`,
content: `<div class="b3-form__icon" style="margin: 8px">
<span data-menu="true" class="b3-form__icon-list fn__a b3-tooltips b3-tooltips__s" aria-label="${updateHotkeyTip("⌥↓")}">
<svg class="svg--mid"><use xlink:href="#iconSearch"></use></svg>
@@ -178,6 +180,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
}
}
});
+ dialog.element.querySelector(".b3-dialog__header").setAttribute("style", "padding:0");
dialog.element.setAttribute("data-key", Constants.DIALOG_MOVEPATHTO);
if (paths && paths.length > 0) {
fetchPost("/api/filetree/getHPathsByPaths", {paths}, (response) => {
@@ -260,7 +263,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
const toggleMovePathHistory = () => {
const keys = window.siyuan.storage[Constants.LOCAL_MOVE_PATH].keys;
- if (!keys || keys.length === 0) {
+ if (!keys || keys.length === 0 || (keys.length === 1 && keys[0] === inputElement.value)) {
return;
}
const menu = new Menu("move-path-history");