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

Vanessa7ae90058c3b1
diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts
index 55e66570a3..8e9f3d5d83 100644
--- a/app/src/plugin/API.ts
+++ b/app/src/plugin/API.ts
@@ -236,9 +236,13 @@ const getActiveEditor = (wndActive = true) => {
if (!editor && !wndActive) {
let activeTime = 0;
allEditor.forEach(item => {
- const headerElement = item.protyle?.model.parent.headElement;
- if (headerElement && headerElement.classList.contains("item--focus") && parseInt(headerElement.dataset.activetime) > activeTime) {
- activeTime = parseInt(headerElement.dataset.activetime);
+ const headerElement = item.protyle.model?.parent.headElement;
+ if (headerElement) {
+ if (headerElement.classList.contains("item--focus") && parseInt(headerElement.dataset.activetime) > activeTime) {
+ activeTime = parseInt(headerElement.dataset.activetime);
+ editor = item;
+ }
+ } else if (item.protyle.element.getBoundingClientRect().height > 0) {
editor = item;
}
});