mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 15:56:10 +01:00
This commit is contained in:
parent
0c6c90a82d
commit
12ebc120a0
10 changed files with 184 additions and 119 deletions
|
|
@ -463,37 +463,41 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
|
|||
event.preventDefault();
|
||||
break;
|
||||
} else if (target.id === "searchPath") {
|
||||
movePathTo((toPath, toNotebook) => {
|
||||
fetchPost("/api/filetree/getHPathsByPaths", {paths: toPath}, (response) => {
|
||||
config.idPath = [];
|
||||
const hPathList: string[] = [];
|
||||
let enableIncludeChild = false;
|
||||
toPath.forEach((item, index) => {
|
||||
if (item === "/") {
|
||||
config.idPath.push(toNotebook[index]);
|
||||
hPathList.push(getNotebookName(toNotebook[index]));
|
||||
} else {
|
||||
enableIncludeChild = true;
|
||||
config.idPath.push(pathPosix().join(toNotebook[index], item.replace(".sy", "")));
|
||||
movePathTo({
|
||||
cb: (toPath, toNotebook) => {
|
||||
fetchPost("/api/filetree/getHPathsByPaths", {paths: toPath}, (response) => {
|
||||
config.idPath = [];
|
||||
const hPathList: string[] = [];
|
||||
let enableIncludeChild = false;
|
||||
toPath.forEach((item, index) => {
|
||||
if (item === "/") {
|
||||
config.idPath.push(toNotebook[index]);
|
||||
hPathList.push(getNotebookName(toNotebook[index]));
|
||||
} else {
|
||||
enableIncludeChild = true;
|
||||
config.idPath.push(pathPosix().join(toNotebook[index], item.replace(".sy", "")));
|
||||
}
|
||||
});
|
||||
if (response.data) {
|
||||
hPathList.push(...response.data);
|
||||
}
|
||||
config.hPath = hPathList.join(" ");
|
||||
config.page = 1;
|
||||
searchPathInputElement.innerHTML = `${escapeGreat(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
|
||||
searchPathInputElement.setAttribute("aria-label", escapeHtml(config.hPath));
|
||||
const includeElement = element.querySelector("#searchInclude");
|
||||
includeElement.firstElementChild.classList.add("ft__primary");
|
||||
if (enableIncludeChild) {
|
||||
includeElement.removeAttribute("disabled");
|
||||
} else {
|
||||
includeElement.setAttribute("disabled", "disabled");
|
||||
}
|
||||
inputEvent(element, config, edit, true);
|
||||
});
|
||||
if (response.data) {
|
||||
hPathList.push(...response.data);
|
||||
}
|
||||
config.hPath = hPathList.join(" ");
|
||||
config.page = 1;
|
||||
searchPathInputElement.innerHTML = `${escapeGreat(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
|
||||
searchPathInputElement.setAttribute("aria-label", escapeHtml(config.hPath));
|
||||
const includeElement = element.querySelector("#searchInclude");
|
||||
includeElement.firstElementChild.classList.add("ft__primary");
|
||||
if (enableIncludeChild) {
|
||||
includeElement.removeAttribute("disabled");
|
||||
} else {
|
||||
includeElement.setAttribute("disabled", "disabled");
|
||||
}
|
||||
inputEvent(element, config, edit, true);
|
||||
});
|
||||
}, [], undefined, window.siyuan.languages.specifyPath);
|
||||
},
|
||||
title: window.siyuan.languages.specifyPath,
|
||||
flashcard: false
|
||||
});
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue