mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 07:18:49 +01:00
This commit is contained in:
parent
063110f271
commit
f875cb3ccd
1 changed files with 29 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ const getRightBlock = (element: HTMLElement, x: number, y: number) => {
|
|||
return nodeElement;
|
||||
};
|
||||
|
||||
export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mouseIsEnter: boolean) => {
|
||||
export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||
if (document.body.classList.contains("body--blur") || document.getElementById("progress")) {
|
||||
// 非激活状态下不执行 https://ld246.com/article/1693474547631
|
||||
return;
|
||||
|
|
@ -45,7 +45,7 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
const target = event.target as Element;
|
||||
// Dock
|
||||
if (!mouseIsEnter &&
|
||||
event.buttons === 0 && // 鼠标按键被按下时不触发
|
||||
|
|
@ -57,11 +57,11 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
|
|||
(window.siyuan.layout.leftDock.element.clientWidth > 0 || (window.siyuan.layout.leftDock.element.clientWidth === 0 && event.clientX < 8))) {
|
||||
if (event.clientY > document.getElementById("toolbar").clientHeight &&
|
||||
event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) {
|
||||
if (!hasClosestByClassName(event.target, "b3-menu") &&
|
||||
!hasClosestByClassName(event.target, "protyle-toolbar") &&
|
||||
!hasClosestByClassName(event.target, "protyle-util") &&
|
||||
!hasClosestByClassName(event.target, "b3-dialog", true) &&
|
||||
!hasClosestByClassName(event.target, "layout--float")) {
|
||||
if (!hasClosestByClassName(target, "b3-menu") &&
|
||||
!hasClosestByClassName(target, "protyle-toolbar") &&
|
||||
!hasClosestByClassName(target, "protyle-util") &&
|
||||
!hasClosestByClassName(target, "b3-dialog", true) &&
|
||||
!hasClosestByClassName(target, "layout--float")) {
|
||||
window.siyuan.layout.leftDock.showDock();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -73,11 +73,11 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
|
|||
(window.siyuan.layout.rightDock.element.clientWidth > 0 || (window.siyuan.layout.rightDock.element.clientWidth === 0 && event.clientX > window.innerWidth - 8))) {
|
||||
if (event.clientY > document.getElementById("toolbar").clientHeight &&
|
||||
event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) {
|
||||
if (!hasClosestByClassName(event.target, "b3-menu") &&
|
||||
!hasClosestByClassName(event.target, "layout--float") &&
|
||||
!hasClosestByClassName(event.target, "protyle-toolbar") &&
|
||||
!hasClosestByClassName(event.target, "protyle-util") &&
|
||||
!hasClosestByClassName(event.target, "b3-dialog", true)) {
|
||||
if (!hasClosestByClassName(target, "b3-menu") &&
|
||||
!hasClosestByClassName(target, "layout--float") &&
|
||||
!hasClosestByClassName(target, "protyle-toolbar") &&
|
||||
!hasClosestByClassName(target, "protyle-util") &&
|
||||
!hasClosestByClassName(target, "b3-dialog", true)) {
|
||||
window.siyuan.layout.rightDock.showDock();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -191,14 +191,29 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
|
|||
return;
|
||||
}
|
||||
|
||||
if (!hasClosestByClassName(event.target, "protyle", true)) {
|
||||
if (eventPath0 && eventPath0.nodeType !== 3 && eventPath0.classList.contains("av")) {
|
||||
// 数据库居中时光标在数据库侧边 https://github.com/siyuan-note/siyuan/issues/13853
|
||||
if (eventPath0.getAttribute("data-type") === "NodeAttributeView") {
|
||||
const rowElement = hasClosestByClassName(document.elementFromPoint(eventPath0.firstElementChild.getBoundingClientRect().left + 10, event.clientY), "av__row")
|
||||
if (rowElement && !rowElement.classList.contains("av__row--header")) {
|
||||
getAllEditor().find(item => {
|
||||
if (item.protyle.wysiwyg.element.contains(eventPath0)) {
|
||||
item.protyle.gutter.render(item.protyle, eventPath0, item.protyle.wysiwyg.element, rowElement);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasClosestByClassName(target, "protyle", true)) {
|
||||
document.querySelectorAll(".protyle-gutters").forEach(item => {
|
||||
item.classList.add("fn__none");
|
||||
item.innerHTML = "";
|
||||
});
|
||||
}
|
||||
|
||||
const target = event.target as Element;
|
||||
const blockElement = hasClosestByClassName(target, "table");
|
||||
if (blockElement && blockElement.style.cursor !== "col-resize" && !hasClosestByClassName(blockElement, "protyle-wysiwyg__embed")) {
|
||||
const cellElement = (hasClosestByTag(target, "TH") || hasClosestByTag(target, "TD")) as HTMLTableCellElement;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue