|
@@ -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;
|