mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 16:11:49 +08:00
This commit is contained in:
parent
a7dd56e672
commit
866189bcc0
@ -22,7 +22,7 @@ import {onGet} from "../protyle/util/onGet";
|
|||||||
import {addLoading} from "../protyle/ui/initUI";
|
import {addLoading} from "../protyle/ui/initUI";
|
||||||
import {getIconByType} from "../editor/getIcon";
|
import {getIconByType} from "../editor/getIcon";
|
||||||
import {unicode2Emoji} from "../emoji";
|
import {unicode2Emoji} from "../emoji";
|
||||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||||
import {isIPad, isNotCtrl, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
|
import {isIPad, isNotCtrl, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||||
import {newFileByName} from "../util/newFile";
|
import {newFileByName} from "../util/newFile";
|
||||||
import {
|
import {
|
||||||
@ -1102,7 +1102,12 @@ export const getArticle = (options: {
|
|||||||
if (isSupportCSSHL()) {
|
if (isSupportCSSHL()) {
|
||||||
searchMarkRender(options.edit.protyle, getResponse.data.keywords, options.id, () => {
|
searchMarkRender(options.edit.protyle, getResponse.data.keywords, options.id, () => {
|
||||||
if (options.edit.protyle.highlight.ranges.length > 0 && options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex]) {
|
if (options.edit.protyle.highlight.ranges.length > 0 && options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex]) {
|
||||||
options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex].getBoundingClientRect().top - contentRect.top - contentRect.height / 2;
|
const blockElement = hasClosestBlock(options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex].startContainer)
|
||||||
|
if (blockElement && blockElement.getAttribute("data-node-id") !== options.id) {
|
||||||
|
highlightById(options.edit.protyle, options.id);
|
||||||
|
} else {
|
||||||
|
options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex].getBoundingClientRect().top - contentRect.top - contentRect.height / 2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
highlightById(options.edit.protyle, options.id);
|
highlightById(options.edit.protyle, options.id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user