mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 04:18:48 +01:00
This commit is contained in:
parent
a5f9771e03
commit
a67ec08adb
2 changed files with 19 additions and 14 deletions
|
|
@ -281,6 +281,11 @@
|
|||
border-right-color: var(--b3-theme-primary-lighter);
|
||||
}
|
||||
|
||||
&.dragover__left,
|
||||
&.dragover__right {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&--select {
|
||||
background-color: var(--b3-menu-background);
|
||||
box-shadow: 2px 2px 0 var(--b3-theme-primary-lighter) inset, -2px -2px 0 var(--b3-theme-primary-lighter) inset;
|
||||
|
|
@ -528,21 +533,13 @@
|
|||
.dragover__top,
|
||||
.dragover__bottom {
|
||||
.av__colsticky {
|
||||
z-index: 0;
|
||||
|
||||
& > div {
|
||||
&.av__firstcol,
|
||||
& > div:not(.av__cell--select):not(.av__cell--active):not(.av__calc--ashow) {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dragover__bottom + .av__row,
|
||||
.av__row:has(+ .dragover__top) {
|
||||
.av__colsticky > div {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
img.av__cellassetimg {
|
||||
max-height: calc(1.625em - 2px);
|
||||
border-radius: var(--b3-border-radius);
|
||||
|
|
|
|||
|
|
@ -1158,7 +1158,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (targetElement) {
|
||||
const targetRowElement = hasClosestByClassName(targetElement, "av__row--header");
|
||||
const dragRowElement = hasClosestByClassName(window.siyuan.dragElement, "av__row--header");
|
||||
if (!targetRowElement || !dragRowElement ||
|
||||
if (targetElement.isSameNode(window.siyuan.dragElement) || !targetRowElement || !dragRowElement ||
|
||||
(targetRowElement && dragRowElement && !targetRowElement.isSameNode(dragRowElement))
|
||||
) {
|
||||
targetElement = false;
|
||||
|
|
@ -1200,11 +1200,15 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
|
||||
if (targetElement.classList.contains("av__cell")) {
|
||||
if (event.clientX < nodeRect.left + nodeRect.width / 2 && event.clientX > nodeRect.left &&
|
||||
!targetElement.classList.contains("av__row")) {
|
||||
!targetElement.classList.contains("av__row") && !targetElement.previousElementSibling.isSameNode(window.siyuan.dragElement)) {
|
||||
targetElement.classList.add("dragover__left");
|
||||
} else if (event.clientX > nodeRect.right - nodeRect.width / 2 && event.clientX <= nodeRect.right + 1 &&
|
||||
!targetElement.classList.contains("av__row")) {
|
||||
targetElement.classList.add("dragover__right");
|
||||
!targetElement.classList.contains("av__row") && !targetElement.isSameNode(window.siyuan.dragElement.previousElementSibling)) {
|
||||
if (window.siyuan.dragElement.previousElementSibling.classList.contains("av__colsticky") && targetElement.isSameNode(window.siyuan.dragElement.previousElementSibling.lastElementChild)) {
|
||||
// 拖拽到固定列的最后一个元素
|
||||
} else {
|
||||
targetElement.classList.add("dragover__right");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -1240,6 +1244,10 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
// 表头不能拖到自己上
|
||||
return;
|
||||
}
|
||||
if (gutterTypes[0] === "nodeattributeviewrowmenu" && gutterTypes[2] === targetElement.getAttribute("data-id")) {
|
||||
// 行不能拖到自己上
|
||||
return;
|
||||
}
|
||||
const isSelf = gutterTypes[2].split(",").find((item: string) => {
|
||||
if (item && hasClosestByAttribute(targetElement as HTMLElement, "data-node-id", item)) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue