Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Vanessab65aeac03c44
diff --git a/app/src/boot/globalEvent/searchKeydown.ts b/app/src/boot/globalEvent/searchKeydown.ts
index 7476a979f3..4f70b180f7 100644
--- a/app/src/boot/globalEvent/searchKeydown.ts
+++ b/app/src/boot/globalEvent/searchKeydown.ts
@@ -99,6 +99,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.insertRight.custom, event)) {
openSearchEditor({
protyle: edit.protyle,
+ rootId: currentList.getAttribute("data-root-id"),
id: currentList.getAttribute("data-node-id"),
cb: () => {
if (dialog) {
@@ -217,6 +218,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
replace(element, config, edit, false);
} else {
openSearchEditor({
+ rootId: currentList.getAttribute("data-root-id"),
protyle: edit.protyle,
id: currentList.getAttribute("data-node-id"),
cb: () => {
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 78696b040c..077547ddf1 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -817,6 +817,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
} else {
if (event.altKey) {
openSearchEditor({
+ rootId: target.getAttribute("data-root-id"),
protyle: edit.protyle,
id: target.getAttribute("data-node-id"),
cb: closeCB,
@@ -850,6 +851,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
/// #endif
} else {
openSearchEditor({
+ rootId: target.getAttribute("data-root-id"),
protyle: edit.protyle,
id: target.getAttribute("data-node-id"),
cb: closeCB
@@ -918,10 +920,12 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
export const openSearchEditor = (options: {
protyle: IProtyle,
openPosition?: string,
- id?: string,
- cb?: () => void
+ id: string,
+ 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) {
const rangeBlockElement = hasClosestBlock(currentRange.startContainer);
if (rangeBlockElement) {