🎨 Find and replace supports query syntax https://github.com/siyuan-note/siyuan/issues/14937

This commit is contained in:
Daniel 2025-05-30 12:11:49 +08:00
parent 93ceb872ce
commit 572baa99bd
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 24 additions and 25 deletions

View file

@ -35,7 +35,7 @@ import {
} from "../../search/toggleHistory";
const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAll: boolean) => {
if (config.method === 1 || config.method === 2) {
if (config.method === 2) {
showMessage(window.siyuan.languages._kernel[132]);
return;
}
@ -55,7 +55,7 @@ const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAl
loadElement.nextElementSibling.classList.add("fn__none");
const currentId = currentLiElement.getAttribute("data-node-id");
fetchPost("/api/search/findReplace", {
k: config.method === 0 ? getKeyByLiElement(currentLiElement) : (document.querySelector("#toolbarSearch") as HTMLInputElement).value,
k: config.method === 0 || config.method === 1 ? getKeyByLiElement(currentLiElement) : (document.querySelector("#toolbarSearch") as HTMLInputElement).value,
r: replaceInputElement.value,
ids: isAll ? [] : [currentId],
types: config.types,

View file

@ -9,14 +9,7 @@ import {openFile, openFileById} from "../editor/util";
import {showMessage} from "../dialog/message";
import {reloadProtyle} from "../protyle/util/reload";
import {MenuItem} from "../menus/Menu";
import {
getDisplayName,
getNotebookIcon,
getNotebookName,
movePathTo,
pathPosix,
useShell
} from "../util/pathName";
import {getDisplayName, getNotebookIcon, getNotebookName, movePathTo, pathPosix, useShell} from "../util/pathName";
import {Protyle} from "../protyle";
import {onGet} from "../protyle/util/onGet";
import {addLoading} from "../protyle/ui/initUI";
@ -1161,7 +1154,7 @@ export const getArticle = (options: {
};
export const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle, isAll: boolean) => {
if (config.method === 1 || config.method === 2) {
if (config.method === 2) {
showMessage(window.siyuan.languages._kernel[132]);
return;
}
@ -1181,7 +1174,7 @@ export const replace = (element: Element, config: Config.IUILayoutTabSearchConfi
loadElement.classList.remove("fn__none");
const currentId = currentList.getAttribute("data-node-id");
fetchPost("/api/search/findReplace", {
k: config.method === 0 ? getKeyByLiElement(currentList) : searchInputElement.value,
k: config.method === 0 || config.method === 1 ? getKeyByLiElement(currentList) : searchInputElement.value,
r: replaceInputElement.value,
method: config.method,
types: config.types,