diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index a9e7b9127..81e2ff646 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -366,6 +366,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { accelerator: window.siyuan.config.keymap.editor.general.openBy.custom + "/" + window.siyuan.languages.click, click() { checkFold(refBlockId, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id: refBlockId, @@ -397,6 +398,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { accelerator: window.siyuan.config.keymap.editor.general.insertRight.custom + "/⌥" + window.siyuan.languages.click, click() { checkFold(refBlockId, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id: refBlockId, @@ -413,6 +415,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { accelerator: window.siyuan.config.keymap.editor.general.insertBottom.custom + (window.siyuan.config.keymap.editor.general.insertBottom.custom ? "/" : "") + "⇧" + window.siyuan.languages.click, click() { checkFold(refBlockId, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id: refBlockId, diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 536761832..328aae9ab 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2043,7 +2043,6 @@ export class WYSIWYG { } const range = getEditorRange(this.element); // 需放在嵌入块之前,否则嵌入块内的引用、链接、pdf 双链无法点击打开 https://ld246.com/article/1630479789513 - const blockRefElement = hasClosestByAttribute(event.target, "data-type", "block-ref"); const aElement = hasClosestByAttribute(event.target, "data-type", "a") || hasClosestByClassName(event.target, "av__celltext--url"); // 数据库中资源文件、链接、电话、邮箱单元格 let aLink = aElement ? (aElement.getAttribute("data-href") || "") : ""; @@ -2058,6 +2057,7 @@ export class WYSIWYG { } } + const blockRefElement = hasClosestByAttribute(event.target, "data-type", "block-ref"); if (blockRefElement || aLink.startsWith("siyuan://blocks/")) { event.stopPropagation(); event.preventDefault(); @@ -2073,6 +2073,8 @@ export class WYSIWYG { refBlockId = aLink.substring(16, 38); } checkFold(refBlockId, (zoomIn, action) => { + // 块引用跳转后需要短暂高亮目标块 https://github.com/siyuan-note/siyuan/issues/11542 + action.push(Constants.CB_GET_HL); /// #if MOBILE openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); activeBlur(); diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index c7e636bc7..5fbb38662 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1525,6 +1525,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const id = refElement.getAttribute("data-id"); if (matchHotKey(window.siyuan.config.keymap.editor.general.openBy.custom, event)) { checkFold(id, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id, @@ -1551,6 +1552,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { return true; } else if (matchHotKey(window.siyuan.config.keymap.editor.general.insertRight.custom, event)) { checkFold(id, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id, @@ -1564,6 +1566,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { return true; } else if (matchHotKey(window.siyuan.config.keymap.editor.general.insertBottom.custom, event)) { checkFold(id, (zoomIn, action) => { + action.push(Constants.CB_GET_HL); openFileById({ app: protyle.app, id,