Vanessa 2025-11-30 16:58:47 +08:00
parent 9da4fc4530
commit b65aeac03c
2 changed files with 9 additions and 3 deletions

View file

@ -99,6 +99,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.insertRight.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.insertRight.custom, event)) {
openSearchEditor({ openSearchEditor({
protyle: edit.protyle, protyle: edit.protyle,
rootId: currentList.getAttribute("data-root-id"),
id: currentList.getAttribute("data-node-id"), id: currentList.getAttribute("data-node-id"),
cb: () => { cb: () => {
if (dialog) { if (dialog) {
@ -217,6 +218,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
replace(element, config, edit, false); replace(element, config, edit, false);
} else { } else {
openSearchEditor({ openSearchEditor({
rootId: currentList.getAttribute("data-root-id"),
protyle: edit.protyle, protyle: edit.protyle,
id: currentList.getAttribute("data-node-id"), id: currentList.getAttribute("data-node-id"),
cb: () => { cb: () => {

View file

@ -817,6 +817,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
} else { } else {
if (event.altKey) { if (event.altKey) {
openSearchEditor({ openSearchEditor({
rootId: target.getAttribute("data-root-id"),
protyle: edit.protyle, protyle: edit.protyle,
id: target.getAttribute("data-node-id"), id: target.getAttribute("data-node-id"),
cb: closeCB, cb: closeCB,
@ -850,6 +851,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
/// #endif /// #endif
} else { } else {
openSearchEditor({ openSearchEditor({
rootId: target.getAttribute("data-root-id"),
protyle: edit.protyle, protyle: edit.protyle,
id: target.getAttribute("data-node-id"), id: target.getAttribute("data-node-id"),
cb: closeCB cb: closeCB
@ -918,10 +920,12 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
export const openSearchEditor = (options: { export const openSearchEditor = (options: {
protyle: IProtyle, protyle: IProtyle,
openPosition?: string, openPosition?: string,
id?: string, id: string,
cb?: () => void rootId: string,
cb: () => void
}) => { }) => {
let currentRange = options.protyle.highlight.ranges[options.protyle.highlight.rangeIndex]; let currentRange = (options.rootId === options.protyle.block.rootID && options.id === options.protyle.block.id) ?
options.protyle.highlight.ranges[options.protyle.highlight.rangeIndex] : null;
if (currentRange) { if (currentRange) {
const rangeBlockElement = hasClosestBlock(currentRange.startContainer); const rangeBlockElement = hasClosestBlock(currentRange.startContainer);
if (rangeBlockElement) { if (rangeBlockElement) {