Browse Source

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

Vanessa 1 năm trước cách đây
mục cha
commit
60f6bf9a64

+ 5 - 0
app/src/boot/globalEvent/command/global.ts

@@ -23,6 +23,7 @@ import {Constants} from "../../../constants";
 import {setReadOnly} from "../../../config/util/setReadOnly";
 import {setReadOnly} from "../../../config/util/setReadOnly";
 import {lockScreen} from "../../../dialog/processSystem";
 import {lockScreen} from "../../../dialog/processSystem";
 import {newFile} from "../../../util/newFile";
 import {newFile} from "../../../util/newFile";
+import {openCard} from "../../../card/openCard";
 
 
 export const globalCommand = (command: string, app: App) => {
 export const globalCommand = (command: string, app: App) => {
     /// #if MOBILE
     /// #if MOBILE
@@ -78,6 +79,7 @@ export const globalCommand = (command: string, app: App) => {
             openSearch({
             openSearch({
                 app,
                 app,
                 hotkey: Constants.DIALOG_GLOBALSEARCH,
                 hotkey: Constants.DIALOG_GLOBALSEARCH,
+                key: (getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : document.createRange()).toString()
             });
             });
             return true;
             return true;
         case "goBack":
         case "goBack":
@@ -256,6 +258,9 @@ export const globalCommand = (command: string, app: App) => {
                 useSavePath: true
                 useSavePath: true
             });
             });
             return true;
             return true;
+        case "riffCard":
+            openCard(app);
+            return true;
     }
     }
 
 
     return false;
     return false;

+ 136 - 15
app/src/boot/globalEvent/command/panel.ts

@@ -7,19 +7,22 @@ import {Constants} from "../../../constants";
 import {Editor} from "../../../editor";
 import {Editor} from "../../../editor";
 /// #if MOBILE
 /// #if MOBILE
 import {getCurrentEditor} from "../../../mobile/editor";
 import {getCurrentEditor} from "../../../mobile/editor";
+import {popSearch} from "../../../mobile/menu/search";
 /// #else
 /// #else
 import {getActiveTab, getDockByType} from "../../../layout/tabUtil";
 import {getActiveTab, getDockByType} from "../../../layout/tabUtil";
 import {Custom} from "../../../layout/dock/Custom";
 import {Custom} from "../../../layout/dock/Custom";
 import {getAllModels} from "../../../layout/getAll";
 import {getAllModels} from "../../../layout/getAll";
 import {Files} from "../../../layout/dock/Files";
 import {Files} from "../../../layout/dock/Files";
 import {Search} from "../../../search";
 import {Search} from "../../../search";
+import {openSearch} from "../../../search/spread";
 /// #endif
 /// #endif
 import {addEditorToDatabase, addFilesToDatabase} from "../../../protyle/render/av/addToDatabase";
 import {addEditorToDatabase, addFilesToDatabase} from "../../../protyle/render/av/addToDatabase";
-import {hasClosestBlock, hasClosestByClassName} from "../../../protyle/util/hasClosest";
+import {hasClosestBlock, hasClosestByClassName, hasTopClosestByTag} from "../../../protyle/util/hasClosest";
 import {onlyProtyleCommand} from "./protyle";
 import {onlyProtyleCommand} from "./protyle";
 import {globalCommand} from "./global";
 import {globalCommand} from "./global";
-import {getTopPaths, movePathTo, moveToPath} from "../../../util/pathName";
+import {getDisplayName, getNotebookName, getTopPaths, movePathTo, moveToPath, pathPosix} from "../../../util/pathName";
 import {hintMoveBlock} from "../../../protyle/hint/extend";
 import {hintMoveBlock} from "../../../protyle/hint/extend";
+import {fetchSyncPost} from "../../../util/fetch";
 
 
 export const commandPanel = (app: App) => {
 export const commandPanel = (app: App) => {
     const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined;
     const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined;
@@ -48,9 +51,9 @@ export const commandPanel = (app: App) => {
         /// #if MOBILE
         /// #if MOBILE
         keys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks",
         keys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks",
             "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch",
             "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch",
-            "lockScreen", "mainMenu", "move", "newFile", "recentDocs",
+            "lockScreen", "mainMenu", "move", "newFile", "recentDocs", "replace", "riffCard", "search",
 
 
-            "replace", "riffCard", "search", "selectOpen1",
+            "selectOpen1",
             "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",
             "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",
             "toggleDock", "toggleWin"];
             "toggleDock", "toggleWin"];
         /// #else
         /// #else
@@ -59,9 +62,9 @@ export const commandPanel = (app: App) => {
             "closeUnmodified", "config", "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch", "goBack",
             "closeUnmodified", "config", "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch", "goBack",
             "goForward", "goToEditTabNext", "goToEditTabPrev", "goToTab1", "goToTab2", "goToTab3", "goToTab4",
             "goForward", "goToEditTabNext", "goToEditTabPrev", "goToTab1", "goToTab2", "goToTab3", "goToTab4",
             "goToTab5", "goToTab6", "goToTab7", "goToTab8", "goToTab9", "goToTabNext", "goToTabPrev", "lockScreen",
             "goToTab5", "goToTab6", "goToTab7", "goToTab8", "goToTab9", "goToTabNext", "goToTabPrev", "lockScreen",
-            "mainMenu", "move", "newFile", "recentDocs",
+            "mainMenu", "move", "newFile", "recentDocs", "replace", "riffCard", "search",
 
 
-            "replace", "riffCard", "search", "selectOpen1",
+            "selectOpen1",
             "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",
             "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",
             "toggleDock", "toggleWin"];
             "toggleDock", "toggleWin"];
 
 
@@ -172,7 +175,7 @@ const filterList = (inputElement: HTMLInputElement, listElement: Element) => {
     });
     });
 };
 };
 
 
-export const execByCommand = (options: {
+export const execByCommand = async (options: {
     command: string,
     command: string,
     app?: App,
     app?: App,
     previousRange?: Range,
     previousRange?: Range,
@@ -192,7 +195,7 @@ export const execByCommand = (options: {
         options.previousRange = protyle.toolbar.range;
         options.previousRange = protyle.toolbar.range;
     }
     }
     /// #endif
     /// #endif
-    const range: Range = options.previousRange || getSelection().getRangeAt(0);
+    const range: Range = options.previousRange || (getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : document.createRange());
     let fileLiElements = options.fileLiElements;
     let fileLiElements = options.fileLiElements;
     if (!isFileFocus && !protyle) {
     if (!isFileFocus && !protyle) {
         if (range) {
         if (range) {
@@ -230,9 +233,6 @@ export const execByCommand = (options: {
                     });
                     });
                 }
                 }
             }
             }
-            if (!protyle) {
-                return;
-            }
         } else if (!protyle) {
         } else if (!protyle) {
             if (!protyle && range) {
             if (!protyle && range) {
                 window.siyuan.blockPanels.find(item => {
                 window.siyuan.blockPanels.find(item => {
@@ -274,14 +274,11 @@ export const execByCommand = (options: {
                     }
                     }
                 });
                 });
             }
             }
-            if (!protyle) {
-                return false;
-            }
         }
         }
     }
     }
 
 
     // only protyle
     // only protyle
-    if (!isFileFocus && onlyProtyleCommand({
+    if (!isFileFocus && protyle && onlyProtyleCommand({
         command: options.command,
         command: options.command,
         previousRange: range,
         previousRange: range,
         protyle
         protyle
@@ -298,8 +295,132 @@ export const execByCommand = (options: {
         fileLiElements = Array.from(files.element.querySelectorAll(".b3-list-item--focus"));
         fileLiElements = Array.from(files.element.querySelectorAll(".b3-list-item--focus"));
     }
     }
 
 
+    // 全局命令,在没有 protyle 和文件树没聚焦的情况下执行
+    if ((!protyle && !isFileFocus) ||
+        (isFileFocus && (!fileLiElements || fileLiElements.length === 0)) ||
+        (isMobile() && !document.getElementById("empty").classList.contains("fn__none"))) {
+        if (options.command === "replace") {
+            /// #if MOBILE
+            popSearch(options.app, {hasReplace: true, page: 1});
+            /// #else
+            openSearch({
+                app: options.app,
+                hotkey: Constants.DIALOG_REPLACE,
+                key: range.toString()
+            });
+            /// #endif
+        } else if (options.command === "search") {
+            /// #if MOBILE
+            popSearch(options.app, {hasReplace: false, page: 1});
+            /// #else
+            openSearch({
+                app: options.app,
+                hotkey: Constants.DIALOG_SEARCH,
+                key: range.toString()
+            });
+            /// #endif
+        }
+        return;
+    }
+
     // protyle and file tree
     // protyle and file tree
     switch (options.command) {
     switch (options.command) {
+        case "replace":
+            if (!isFileFocus) {
+                /// #if MOBILE
+                const response = await fetchSyncPost("/api/filetree/getHPathByPath", {
+                    notebook: protyle.notebookId,
+                    path: protyle.path.endsWith(".sy") ? protyle.path : protyle.path + ".sy"
+                });
+                popSearch(options.app, {
+                    page: 1,
+                    hasReplace: true,
+                    hPath: pathPosix().join(getNotebookName(protyle.notebookId), response.data),
+                    idPath: [pathPosix().join(protyle.notebookId, protyle.path)]
+                });
+                /// #else
+                openSearch({
+                    app: options.app,
+                    hotkey: Constants.DIALOG_REPLACE,
+                    key: range.toString(),
+                    notebookId: protyle.notebookId,
+                    searchPath: protyle.path
+                });
+                /// #endif
+            } else {
+                /// #if !MOBILE
+                const topULElement = hasTopClosestByTag(fileLiElements[0], "UL");
+                if (!topULElement) {
+                    return false;
+                }
+                const notebookId = topULElement.getAttribute("data-url");
+                const pathString = fileLiElements[0].getAttribute("data-path");
+                const isFile = fileLiElements[0].getAttribute("data-type") === "navigation-file";
+                if (isFile) {
+                    openSearch({
+                        app: options.app,
+                        hotkey: Constants.DIALOG_REPLACE,
+                        notebookId: notebookId,
+                        searchPath: getDisplayName(pathString, false, true)
+                    });
+                } else {
+                    openSearch({
+                        app: options.app,
+                        hotkey: Constants.DIALOG_REPLACE,
+                        notebookId: notebookId,
+                    });
+                }
+                /// #endif
+            }
+            break;
+        case "search":
+            if (!isFileFocus) {
+                /// #if MOBILE
+                const response = await fetchSyncPost("/api/filetree/getHPathByPath", {
+                    notebook: protyle.notebookId,
+                    path: protyle.path.endsWith(".sy") ? protyle.path : protyle.path + ".sy"
+                });
+                popSearch(options.app, {
+                    page: 1,
+                    hasReplace: false,
+                    hPath: pathPosix().join(getNotebookName(protyle.notebookId), response.data),
+                    idPath: [pathPosix().join(protyle.notebookId, protyle.path)]
+                });
+                /// #else
+                openSearch({
+                    app: options.app,
+                    hotkey: Constants.DIALOG_SEARCH,
+                    key: range.toString(),
+                    notebookId: protyle.notebookId,
+                    searchPath: protyle.path
+                });
+                /// #endif
+            } else {
+                /// #if !MOBILE
+                const topULElement = hasTopClosestByTag(fileLiElements[0], "UL");
+                if (!topULElement) {
+                    return false;
+                }
+                const notebookId = topULElement.getAttribute("data-url");
+                const pathString = fileLiElements[0].getAttribute("data-path");
+                const isFile = fileLiElements[0].getAttribute("data-type") === "navigation-file";
+                if (isFile) {
+                    openSearch({
+                        app: options.app,
+                        hotkey: Constants.DIALOG_SEARCH,
+                        notebookId: notebookId,
+                        searchPath: getDisplayName(pathString, false, true)
+                    });
+                } else {
+                    openSearch({
+                        app: options.app,
+                        hotkey: Constants.DIALOG_SEARCH,
+                        notebookId: notebookId,
+                    });
+                }
+                /// #endif
+            }
+            break;
         case "addToDatabase":
         case "addToDatabase":
             if (!isFileFocus) {
             if (!isFileFocus) {
                 addEditorToDatabase(protyle, range);
                 addEditorToDatabase(protyle, range);

+ 50 - 60
app/src/boot/globalEvent/keydown.ts

@@ -269,27 +269,23 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
             return false;
             return false;
         }
         }
     }
     }
-    let searchKey = "";
-    if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
-        searchKey = Constants.DIALOG_REPLACE;
-    } else if (matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
-        searchKey = Constants.DIALOG_SEARCH;
-    }
-    if (!isFileFocus && searchKey) {
-        if (range && protyle.element.contains(range.startContainer)) {
-            openSearch({
-                app,
-                hotkey: searchKey,
-                key: range.toString(),
-                notebookId: protyle.notebookId,
-                searchPath: protyle.path
-            });
-        } else {
-            openSearch({
-                app,
-                hotkey: searchKey,
-            });
-        }
+    if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
+        execByCommand({
+            command: "replace",
+            app,
+            protyle,
+            previousRange: range
+        });
+        event.preventDefault();
+        return true;
+    }
+    if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
+        execByCommand({
+            command: "search",
+            app,
+            protyle,
+            previousRange: range
+        });
         event.preventDefault();
         event.preventDefault();
         return true;
         return true;
     }
     }
@@ -679,28 +675,23 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {
         return true;
         return true;
     }
     }
 
 
-    let searchKey = "";
     if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
     if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
-        searchKey = Constants.DIALOG_REPLACE;
-    } else if (matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
-        searchKey = Constants.DIALOG_SEARCH;
+        window.siyuan.menus.menu.remove();
+        execByCommand({
+            command: "replace",
+            app,
+            fileLiElements: liElements,
+        });
+        event.preventDefault();
+        return true;
     }
     }
-    if (searchKey) {
+    if (matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
         window.siyuan.menus.menu.remove();
         window.siyuan.menus.menu.remove();
-        if (isFile) {
-            openSearch({
-                app,
-                hotkey: searchKey,
-                notebookId: notebookId,
-                searchPath: getDisplayName(pathString, false, true)
-            });
-        } else {
-            openSearch({
-                app,
-                hotkey: searchKey,
-                notebookId: notebookId,
-            });
-        }
+        execByCommand({
+            command: "search",
+            app,
+            fileLiElements: liElements,
+        });
         event.preventDefault();
         event.preventDefault();
         return true;
         return true;
     }
     }
@@ -1605,28 +1596,27 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
         return true;
         return true;
     }
     }
 
 
-    let searchKey = "";
     if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
     if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
-        searchKey = Constants.DIALOG_REPLACE;
-    } else if (!hasClosestByClassName(target, "pdf__outer") && matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
-        searchKey = Constants.DIALOG_SEARCH;
-    } else if (matchHotKey(window.siyuan.config.keymap.general.globalSearch.custom, event)) {
-        searchKey = Constants.DIALOG_GLOBALSEARCH;
+        execByCommand({
+            command: "replace",
+            app,
+        });
+        event.preventDefault();
+        return;
     }
     }
-    if (searchKey) {
-        if (getSelection().rangeCount > 0) {
-            const range = getSelection().getRangeAt(0);
-            openSearch({
-                app,
-                hotkey: searchKey,
-                key: range.toString(),
-            });
-        } else {
-            openSearch({
-                app,
-                hotkey: searchKey,
-            });
-        }
+    if (matchHotKey(window.siyuan.config.keymap.general.globalSearch.custom, event)) {
+        execByCommand({
+            command: "globalSearch",
+            app,
+        });
+        event.preventDefault();
+        return;
+    }
+    if (!hasClosestByClassName(target, "pdf__outer") && matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
+        execByCommand({
+            command: "search",
+            app,
+        });
         event.preventDefault();
         event.preventDefault();
         return;
         return;
     }
     }

+ 0 - 36
app/src/menus/navigation.ts

@@ -234,20 +234,11 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
         icon: "iconSearch",
         icon: "iconSearch",
         click() {
         click() {
             /// #if MOBILE
             /// #if MOBILE
-            const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
             popSearch(app, {
             popSearch(app, {
-                removed: localData.removed,
-                sort: localData.sort,
-                group: localData.group,
                 hasReplace: false,
                 hasReplace: false,
-                method: localData.method,
                 hPath: getNotebookName(notebookId),
                 hPath: getNotebookName(notebookId),
                 idPath: [notebookId],
                 idPath: [notebookId],
-                k: localData.k,
-                r: localData.r,
                 page: 1,
                 page: 1,
-                types: Object.assign({}, localData.types),
-                replaceTypes: Object.assign({}, localData.replaceTypes)
             });
             });
             /// #else
             /// #else
             openSearch({
             openSearch({
@@ -265,20 +256,11 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
             icon: "iconReplace",
             icon: "iconReplace",
             click() {
             click() {
                 /// #if MOBILE
                 /// #if MOBILE
-                const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(app, {
                 popSearch(app, {
-                    removed: localData.removed,
-                    sort: localData.sort,
-                    group: localData.group,
                     hasReplace: true,
                     hasReplace: true,
-                    method: localData.method,
                     hPath: getNotebookName(notebookId),
                     hPath: getNotebookName(notebookId),
                     idPath: [notebookId],
                     idPath: [notebookId],
-                    k: localData.k,
-                    r: localData.r,
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, localData.types),
-                    replaceTypes: Object.assign({}, localData.replaceTypes)
                 });
                 });
                 /// #else
                 /// #else
                 openSearch({
                 openSearch({
@@ -569,20 +551,11 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
                     notebook: notebookId,
                     notebook: notebookId,
                     path: searchPath + ".sy"
                     path: searchPath + ".sy"
                 });
                 });
-                const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(app, {
                 popSearch(app, {
-                    removed: localData.removed,
-                    sort: localData.sort,
-                    group: localData.group,
                     hasReplace: false,
                     hasReplace: false,
-                    method: localData.method,
                     hPath: pathPosix().join(getNotebookName(notebookId), response.data),
                     hPath: pathPosix().join(getNotebookName(notebookId), response.data),
                     idPath: [pathPosix().join(notebookId, searchPath)],
                     idPath: [pathPosix().join(notebookId, searchPath)],
-                    k: localData.k,
-                    r: localData.r,
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, localData.types),
-                    replaceTypes: Object.assign({}, localData.replaceTypes)
                 });
                 });
                 /// #else
                 /// #else
                 openSearch({
                 openSearch({
@@ -605,20 +578,11 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
                     notebook: notebookId,
                     notebook: notebookId,
                     path: searchPath + ".sy"
                     path: searchPath + ".sy"
                 });
                 });
-                const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(app, {
                 popSearch(app, {
-                    removed: localData.removed,
-                    sort: localData.sort,
-                    group: localData.group,
                     hasReplace: true,
                     hasReplace: true,
-                    method: localData.method,
                     hPath: pathPosix().join(getNotebookName(notebookId), response.data),
                     hPath: pathPosix().join(getNotebookName(notebookId), response.data),
                     idPath: [pathPosix().join(notebookId, searchPath)],
                     idPath: [pathPosix().join(notebookId, searchPath)],
-                    k: localData.k,
-                    r: localData.r,
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, localData.types),
-                    replaceTypes: Object.assign({}, localData.replaceTypes)
                 });
                 });
                 /// #else
                 /// #else
                 openSearch({
                 openSearch({

+ 0 - 6
app/src/mobile/dock/MobileTags.ts

@@ -41,11 +41,7 @@ export class MobileTags {
                         return;
                         return;
                     }
                     }
                 }
                 }
-                const searchOption = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(app, {
                 popSearch(app, {
-                    removed: searchOption.removed,
-                    sort: searchOption.sort,
-                    group: searchOption.group,
                     hasReplace: false,
                     hasReplace: false,
                     method: 0,
                     method: 0,
                     hPath: "",
                     hPath: "",
@@ -53,8 +49,6 @@ export class MobileTags {
                     k: `#${labelName}#`,
                     k: `#${labelName}#`,
                     r: "",
                     r: "",
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, searchOption.types),
-                    replaceTypes: Object.assign({}, searchOption.replaceTypes)
                 });
                 });
             },
             },
             blockExtHTML: window.siyuan.config.readonly ? undefined : '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>',
             blockExtHTML: window.siyuan.config.readonly ? undefined : '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>',

+ 12 - 1
app/src/mobile/menu/search.ts

@@ -616,7 +616,18 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab
     }, false);
     }, false);
 };
 };
 
 
-export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOCAL_SEARCHDATA] as Config.IUILayoutTabSearchConfig) => {
+export const popSearch = (app: App, searchConfig?: any) => {
+    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];
+        });
+    }
+
     activeBlur();
     activeBlur();
     hideKeyboardToolbar();
     hideKeyboardToolbar();
     let includeChild = true;
     let includeChild = true;

+ 0 - 6
app/src/protyle/header/Background.ts

@@ -393,11 +393,7 @@ export class Background {
                     /// #if !MOBILE
                     /// #if !MOBILE
                     openGlobalSearch(protyle.app, `#${target.textContent}#`, !window.siyuan.ctrlIsPressed);
                     openGlobalSearch(protyle.app, `#${target.textContent}#`, !window.siyuan.ctrlIsPressed);
                     /// #else
                     /// #else
-                    const searchOption = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                     popSearch(protyle.app, {
                     popSearch(protyle.app, {
-                        removed: searchOption.removed,
-                        sort: searchOption.sort,
-                        group: searchOption.group,
                         hasReplace: false,
                         hasReplace: false,
                         method: 0,
                         method: 0,
                         hPath: "",
                         hPath: "",
@@ -405,8 +401,6 @@ export class Background {
                         k: `#${target.textContent}#`,
                         k: `#${target.textContent}#`,
                         r: "",
                         r: "",
                         page: 1,
                         page: 1,
-                        types: Object.assign({}, searchOption.types),
-                        replaceTypes: Object.assign({}, searchOption.replaceTypes)
                     });
                     });
                     /// #endif
                     /// #endif
                     event.preventDefault();
                     event.preventDefault();

+ 0 - 9
app/src/protyle/header/openTitleMenu.ts

@@ -175,20 +175,11 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
                     notebook: protyle.notebookId,
                     notebook: protyle.notebookId,
                     path: searchPath + ".sy"
                     path: searchPath + ".sy"
                 });
                 });
-                const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(protyle.app, {
                 popSearch(protyle.app, {
-                    removed: localData.removed,
-                    sort: localData.sort,
-                    group: localData.group,
                     hasReplace: false,
                     hasReplace: false,
-                    method: localData.method,
                     hPath: pathPosix().join(getNotebookName(protyle.notebookId), pathResponse.data),
                     hPath: pathPosix().join(getNotebookName(protyle.notebookId), pathResponse.data),
                     idPath: [pathPosix().join(protyle.notebookId, searchPath)],
                     idPath: [pathPosix().join(protyle.notebookId, searchPath)],
-                    k: localData.k,
-                    r: localData.r,
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, localData.types),
-                    replaceTypes: Object.assign({}, localData.replaceTypes)
                 });
                 });
                 /// #else
                 /// #else
                 openSearch({
                 openSearch({

+ 0 - 6
app/src/protyle/wysiwyg/index.ts

@@ -2170,11 +2170,7 @@ export class WYSIWYG {
                 openGlobalSearch(protyle.app, `#${tagElement.textContent}#`, !ctrlIsPressed);
                 openGlobalSearch(protyle.app, `#${tagElement.textContent}#`, !ctrlIsPressed);
                 hideElements(["dialog"]);
                 hideElements(["dialog"]);
                 /// #else
                 /// #else
-                const searchOption = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
                 popSearch(protyle.app, {
                 popSearch(protyle.app, {
-                    removed: searchOption.removed,
-                    sort: searchOption.sort,
-                    group: searchOption.group,
                     hasReplace: false,
                     hasReplace: false,
                     method: 0,
                     method: 0,
                     hPath: "",
                     hPath: "",
@@ -2182,8 +2178,6 @@ export class WYSIWYG {
                     k: `#${tagElement.textContent}#`,
                     k: `#${tagElement.textContent}#`,
                     r: "",
                     r: "",
                     page: 1,
                     page: 1,
-                    types: Object.assign({}, searchOption.types),
-                    replaceTypes: Object.assign({}, searchOption.replaceTypes)
                 });
                 });
                 /// #endif
                 /// #endif
                 return;
                 return;