Vanessa 2025-12-22 19:11:40 +08:00
parent 01223c8110
commit b4bcae49f2

View file

@ -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,