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/16661

Vanessab4bcae49f280
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index dc1cf3e08e..fad2e16255 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -47,6 +47,7 @@ import {saveKeyList, toggleAssetHistory, toggleReplaceHistory, toggleSearchHisto
import {highlightById} from "../util/highlightById";
import {getSelectionOffset} from "../protyle/util/selection";
import {electronUndo} from "../protyle/undo";
+import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
export const openGlobalSearch = (app: App, text: string, replace: boolean, searchData?: Config.IUILayoutTabSearchConfig) => {
text = text.trim();
@@ -934,7 +935,7 @@ export const openSearchEditor = (options: {
const rangeBlockElement = hasClosestBlock(currentRange.startContainer);
if (rangeBlockElement) {
options.id = rangeBlockElement.getAttribute("data-node-id");
- const offset = getSelectionOffset(rangeBlockElement, null, options.protyle.highlight.ranges[options.protyle.highlight.rangeIndex]);
+ const offset = getSelectionOffset(getContenteditableElement(rangeBlockElement), null, options.protyle.highlight.ranges[options.protyle.highlight.rangeIndex]);
const scrollAttr: IScrollAttr = {
rootId: options.protyle.block.rootID,
focusId: options.id,