Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15771

Vanessa65b52a2bc62c
diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts
index 8e9f3d5d83..69c42f6157 100644
--- a/app/src/plugin/API.ts
+++ b/app/src/plugin/API.ts
@@ -236,7 +236,14 @@ const getActiveEditor = (wndActive = true) => {
if (!editor && !wndActive) {
let activeTime = 0;
allEditor.forEach(item => {
- const headerElement = item.protyle.model?.parent.headElement;
+ let headerElement = item.protyle.model?.parent.headElement;
+ if (!headerElement && item.protyle.element.getBoundingClientRect().height > 0) {
+ const tabBodyElement = item.protyle.element.parentElement.parentElement.parentElement;
+ const tabId = tabBodyElement.getAttribute("data-id");
+ if (tabBodyElement.classList.contains("fn__flex-1") && tabId) {
+ headerElement = document.querySelector(`.layout-tab-bar .item[data-id="${tabId}"]`);
+ }
+ }
if (headerElement) {
if (headerElement.classList.contains("item--focus") && parseInt(headerElement.dataset.activetime) > activeTime) {
activeTime = parseInt(headerElement.dataset.activetime);