Vanessa 2024-05-27 10:47:23 +08:00
parent cf4c5396ab
commit eb54ebe5ac
3 changed files with 9 additions and 1 deletions

View file

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

View file

@ -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();

View file

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