Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/8470

Vanessa5831aea56ed4
diff --git a/app/src/boot/globalShortcut.ts b/app/src/boot/globalShortcut.ts
index a6f7c5cf6d..5434362b1c 100644
--- a/app/src/boot/globalShortcut.ts
+++ b/app/src/boot/globalShortcut.ts
@@ -679,7 +679,7 @@ export const globalShortcut = (app: App) => {
// remove blockpopover
const maxEditLevels: { [key: string]: number } = {oid: 0};
window.siyuan.blockPanels.forEach((item) => {
- if (item.targetElement && item.element.getAttribute("data-pin") === "true") {
+ if ((item.targetElement || typeof item.x === "number") && item.element.getAttribute("data-pin") === "true") {
const level = parseInt(item.element.getAttribute("data-level"));
const oid = item.element.getAttribute("data-oid");
if (maxEditLevels[oid]) {
@@ -694,7 +694,7 @@ export const globalShortcut = (app: App) => {
let destroyBlock = false;
for (let i = 0; i < window.siyuan.blockPanels.length; i++) {
const item = window.siyuan.blockPanels[i];
- if (item.targetElement && item.element.getAttribute("data-pin") === "false" &&
+ if ((item.targetElement || typeof item.x === "number") && item.element.getAttribute("data-pin") === "false" &&
parseInt(item.element.getAttribute("data-level")) > (maxEditLevels[item.element.getAttribute("data-oid")] || 0)) {
item.destroy();
destroyBlock = true;