Skip to content

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

:art: global search https://github.com/siyuan-note/siyuan/issues/3171

Vanessa9e7ed1477b86
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index cf5812e710..b3ca26b36e 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -180,10 +180,10 @@ class Protyle {
});
}
});
+ if (mergedOptions.after) {
+ mergedOptions.after(this);
+ }
});
- if (mergedOptions.after) {
- mergedOptions.after(this);
- }
}
public reload() {
diff --git a/app/src/search/spread.ts b/app/src/search/spread.ts
index c40731b44b..fe6d7c4d8c 100644
--- a/app/src/search/spread.ts
+++ b/app/src/search/spread.ts
@@ -663,6 +663,9 @@ const getArticle = (options: {
gutter: true,
breadcrumbDocName: true
},
+ after: (protyle) => {
+ protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${options.id}"] span[data-type="search-mark"]`).scrollIntoView();
+ }
});
} else {
protyle.protyle.scroll.lastScrollTop = 0;
@@ -674,6 +677,7 @@ const getArticle = (options: {
size: options.folded ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
}, getResponse => {
onGet(getResponse, protyle.protyle, options.folded ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL]);
+ protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${options.id}"] span[data-type="search-mark"]`).scrollIntoView();
});
}
};