From 992ab53f4b584978bc5e53b8c2f9a387b0e9c8f1 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 28 Oct 2025 20:05:45 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16209 --- app/src/protyle/render/av/action.ts | 5 +++++ app/src/protyle/render/av/openMenuPanel.ts | 10 ++++++++++ app/src/protyle/render/av/view.ts | 5 +++++ app/src/protyle/wysiwyg/index.ts | 5 +++++ 4 files changed, 25 insertions(+) diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index a685c8d50..097db9e6e 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -282,6 +282,11 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle blockID: blockElement.getAttribute("data-node-id"), id: target.dataset.id, avID: blockElement.getAttribute("data-av-id"), + }], [{ + action: "setAttrViewBlockView", + blockID: blockElement.getAttribute("data-node-id"), + id: target.parentElement.querySelector(".item--focus").getAttribute("data-id"), + avID: blockElement.getAttribute("data-av-id"), }]); } event.preventDefault(); diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 167f23a3b..103c6594a 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -1427,6 +1427,11 @@ export const openMenuPanel = (options: { blockID, id: target.parentElement.dataset.id, avID + }], [{ + action: "setAttrViewBlockView", + blockID, + id: options.blockElement.querySelector(".av__views .item--focus").getAttribute("data-id"), + avID }]); } event.preventDefault(); @@ -1447,6 +1452,11 @@ export const openMenuPanel = (options: { blockID, id: target.parentElement.dataset.id, avID, + }], [{ + action: "setAttrViewBlockView", + blockID, + id: options.blockElement.querySelector(".av__views .item--focus").getAttribute("data-id"), + avID, }]); window.siyuan.menus.menu.remove(); openViewMenu({ diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts index 569264931..685442aba 100644 --- a/app/src/protyle/render/av/view.ts +++ b/app/src/protyle/render/av/view.ts @@ -250,6 +250,11 @@ export const bindSwitcherEvent = (options: { protyle: IProtyle, menuElement: Ele blockID: options.blockElement.getAttribute("data-node-id"), id: currentElement.dataset.id, avID: options.blockElement.getAttribute("data-av-id"), + }], [{ + action: "setAttrViewBlockView", + blockID: options.blockElement.getAttribute("data-node-id"), + id: options.blockElement.querySelector(".av__views .item--focus").getAttribute("data-id"), + avID: options.blockElement.getAttribute("data-av-id"), }]); options.menuElement.remove(); focusBlock(options.blockElement); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 8583054d1..eb018d5f2 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2166,6 +2166,11 @@ export class WYSIWYG { blockID: nodeElement.getAttribute("data-node-id"), id: avTabHeaderElement.dataset.id, avID: nodeElement.getAttribute("data-av-id"), + }], [{ + action: "setAttrViewBlockView", + blockID: nodeElement.getAttribute("data-node-id"), + id: avTabHeaderElement.parentElement.querySelector(".item--focus").getAttribute("data-id"), + avID: nodeElement.getAttribute("data-av-id"), }]); window.siyuan.menus.menu.remove(); openViewMenu({