Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/5675 3

Vanessae91ae262ece0
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index d984a85a4a..5defb713b0 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -715,6 +715,8 @@ export class Toolbar {
pingElement.classList.add("block__icon--active");
pingElement.setAttribute("aria-label", window.siyuan.languages.unpin);
}
+ event.preventDefault()
+ event.stopPropagation();
}
return;
}
@@ -772,32 +774,34 @@ export class Toolbar {
dragBgElement.classList.remove("fn__none");
const x = event.clientX - parseInt(this.subElement.style.left);
const y = event.clientY - parseInt(this.subElement.style.top);
- setTimeout(() => {
- // windows 需等待 dragBgElement 显示后才可以进行 move https://github.com/siyuan-note/siyuan/issues/2950
- documentSelf.onmousemove = (moveEvent: MouseEvent) => {
- let positionX = moveEvent.clientX - x;
- let positionY = moveEvent.clientY - y;
- if (positionX > window.innerWidth - this.subElement.clientWidth) {
- positionX = window.innerWidth - this.subElement.clientWidth;
- }
- if (positionY > window.innerHeight - this.subElement.clientHeight) {
- positionY = window.innerHeight - this.subElement.clientHeight;
- }
- this.subElement.style.left = Math.max(positionX, 0) + "px";
- this.subElement.style.top = Math.max(positionY, Constants.SIZE_TOOLBAR_HEIGHT) + "px";
- this.subElement.firstElementChild.setAttribute("data-drag", "true");
- };
+ // setTimeout(() => {
+ // windows 需等待 dragBgElement 显示后才可以进行 move https://github.com/siyuan-note/siyuan/issues/2950
+ documentSelf.onmousemove = (moveEvent: MouseEvent) => {
+ let positionX = moveEvent.clientX - x;
+ let positionY = moveEvent.clientY - y;
+ if (positionX > window.innerWidth - this.subElement.clientWidth) {
+ positionX = window.innerWidth - this.subElement.clientWidth;
+ }
+ if (positionY > window.innerHeight - this.subElement.clientHeight) {
+ positionY = window.innerHeight - this.subElement.clientHeight;
+ }
+ this.subElement.style.left = Math.max(positionX, 0) + "px";
+ this.subElement.style.top = Math.max(positionY, Constants.SIZE_TOOLBAR_HEIGHT) + "px";
+ this.subElement.firstElementChild.setAttribute("data-drag", "true");
+ };
+ // });
+ console.log("onmousedown");
+ documentSelf.onmouseup = () => {
+ console.log("onmouseup");
+ this.subElement.style.userSelect = "auto";
+ documentSelf.onmousemove = null;
+ documentSelf.onmouseup = null;
+ documentSelf.ondragstart = null;
+ documentSelf.onselectstart = null;
+ documentSelf.onselect = null;
+ dragBgElement.classList.add("fn__none");
+ };
- documentSelf.onmouseup = () => {
- this.subElement.style.userSelect = "auto";
- documentSelf.onmousemove = null;
- documentSelf.onmouseup = null;
- documentSelf.ondragstart = null;
- documentSelf.onselectstart = null;
- documentSelf.onselect = null;
- dragBgElement.classList.add("fn__none");
- };
- });
return;
});
const textElement = this.subElement.querySelector(".b3-text-field") as HTMLTextAreaElement;