mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
6e2fa8cbe1
commit
4df41234a2
1 changed files with 7 additions and 3 deletions
|
|
@ -689,15 +689,19 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab
|
|||
}, false);
|
||||
};
|
||||
|
||||
export const popSearch = (app: App, searchConfig?: any) => {
|
||||
export const popSearch = (app: App, searchConfig?: Config.IUILayoutTabSearchConfig) => {
|
||||
const config: Config.IUILayoutTabSearchConfig = JSON.parse(JSON.stringify(window.siyuan.storage[Constants.LOCAL_SEARCHDATA]));
|
||||
const rangeText = (getCurrentEditor()?.protyle.toolbar.range || (getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : document.createRange())).toString();
|
||||
if (rangeText) {
|
||||
config.k = rangeText;
|
||||
}
|
||||
if (searchConfig) {
|
||||
Object.keys(searchConfig).forEach((key: "r") => {
|
||||
config[key] = searchConfig[key];
|
||||
Object.keys(searchConfig).forEach((key: keyof Config.IUILayoutTabSearchConfig) => {
|
||||
if (key === "idPath") {
|
||||
config[key] = [...searchConfig[key]];
|
||||
} else {
|
||||
config[key as "r"] = searchConfig[key as "r"];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue