mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 20:38:49 +01:00
This commit is contained in:
parent
3b86d181e9
commit
c7df4befbb
2 changed files with 11 additions and 10 deletions
|
|
@ -61,18 +61,19 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
|||
paragraph: window.siyuan.config.search.paragraph,
|
||||
};
|
||||
}
|
||||
let hPath = ""
|
||||
let idPath = ""
|
||||
if (notebookId) {
|
||||
localData.hPath = escapeHtml(getNotebookName(notebookId));
|
||||
localData.idPath = notebookId;
|
||||
hPath = escapeHtml(getNotebookName(notebookId));
|
||||
idPath = notebookId;
|
||||
if (searchPath && searchPath !== "/") {
|
||||
const response = await fetchSyncPost("/api/filetree/getHPathByPath", {
|
||||
notebook: notebookId,
|
||||
path: searchPath.endsWith(".sy") ? searchPath : searchPath + ".sy"
|
||||
});
|
||||
localData.hPath = pathPosix().join(localData.hPath, escapeHtml(response.data));
|
||||
localData.idPath = pathPosix().join(localData.idPath, searchPath);
|
||||
hPath = pathPosix().join(hPath, escapeHtml(response.data));
|
||||
idPath = pathPosix().join(idPath, searchPath);
|
||||
}
|
||||
localStorage.setItem(Constants.LOCAL_SEARCHEDATA, JSON.stringify(localData));
|
||||
}
|
||||
|
||||
let range: Range;
|
||||
|
|
@ -98,8 +99,8 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
|||
r: localData.r || "",
|
||||
hasReplace: hotkey === window.siyuan.config.keymap.general.replace.custom,
|
||||
method: localData.method || 0,
|
||||
hPath: localData.hPath || "",
|
||||
idPath: localData.idPath || "",
|
||||
hPath,
|
||||
idPath,
|
||||
list: localData.list || [],
|
||||
replaceList: localData.replaceList || [],
|
||||
group: localData.group || 0,
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
config.idPath = "";
|
||||
config.hPath = "";
|
||||
element.querySelector("#searchPathInput").innerHTML = config.hPath;
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit);
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
@ -186,13 +186,13 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
config.idPath = toNotebook;
|
||||
config.hPath = escapeHtml(getNotebookName(toNotebook));
|
||||
element.querySelector("#searchPathInput").innerHTML = `${config.hPath}<svg class="search__rmpath"><use xlink:href="#iconClose"></use></svg>`;
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit);
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false);
|
||||
} else {
|
||||
config.idPath = pathPosix().join(toNotebook, toPath);
|
||||
fetchPost("/api/filetree/getHPathsByPaths", {paths: [toPath]}, (response) => {
|
||||
config.hPath = escapeHtml(response.data ? response.data[0] : "");
|
||||
element.querySelector("#searchPathInput").innerHTML = `${config.hPath}<svg class="search__rmpath"><use xlink:href="#iconClose"></use></svg>`;
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit);
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false);
|
||||
});
|
||||
}
|
||||
}, window.siyuan.languages.specifyPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue