mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
This commit is contained in:
parent
978d0151f5
commit
a95b83afa9
4 changed files with 44 additions and 11 deletions
|
|
@ -527,6 +527,26 @@
|
||||||
&.dragover__right::after {
|
&.dragover__right::after {
|
||||||
right: -10px;
|
right: -10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
&.dragover__top::after,
|
||||||
|
&.dragover__bottom::after {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 4px;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
background-color: var(--b3-theme-primary-lighter);
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.dragover__top::after {
|
||||||
|
top: -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.dragover__bottom::after {
|
||||||
|
bottom: -10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ ${window.siyuan.languages[avType === "table" ? "insertRowBefore" : "insertItemBe
|
||||||
blockElement,
|
blockElement,
|
||||||
protyle,
|
protyle,
|
||||||
count: parseInt(inputElement.value),
|
count: parseInt(inputElement.value),
|
||||||
previousID: rowElements[0].previousElementSibling.getAttribute("data-id"),
|
previousID: rowElements[0].previousElementSibling?.getAttribute("data-id"),
|
||||||
groupID: rowElements[0].parentElement.getAttribute("data-group-id")
|
groupID: rowElements[0].parentElement.getAttribute("data-group-id")
|
||||||
});
|
});
|
||||||
menu.close();
|
menu.close();
|
||||||
|
|
@ -636,7 +636,7 @@ ${window.siyuan.languages[avType === "table" ? "insertRowBefore" : "insertItemBe
|
||||||
blockElement,
|
blockElement,
|
||||||
protyle,
|
protyle,
|
||||||
count: parseInt(inputElement.value),
|
count: parseInt(inputElement.value),
|
||||||
previousID: rowElements[0].previousElementSibling.getAttribute("data-id"),
|
previousID: rowElements[0].previousElementSibling?.getAttribute("data-id"),
|
||||||
groupID: rowElements[0].parentElement.getAttribute("data-group-id")
|
groupID: rowElements[0].parentElement.getAttribute("data-group-id")
|
||||||
});
|
});
|
||||||
menu.close();
|
menu.close();
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ const getKanbanHTML = (data: IAVKanban) => {
|
||||||
} else {
|
} else {
|
||||||
galleryHTML += `<div class="${coverClass}"><img loading="lazy" class="av__gallery-img${data.fitImage ? " av__gallery-img--fit" : ""}" src="${getCompressURL(item.coverURL)}"></div>`;
|
galleryHTML += `<div class="${coverClass}"><img loading="lazy" class="av__gallery-img${data.fitImage ? " av__gallery-img--fit" : ""}" src="${getCompressURL(item.coverURL)}"></div>`;
|
||||||
}
|
}
|
||||||
} else if (item.coverContent) {
|
} else if (item.coverContent.trim()) {
|
||||||
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-content">${item.coverContent}</div><div></div></div>`;
|
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-content">${item.coverContent}</div><div></div></div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1171,7 +1171,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
targetElement = hasClosestByClassName(event.target, "av__gallery-item") || hasClosestByClassName(event.target, "av__gallery-add") ||
|
targetElement = hasClosestByClassName(event.target, "av__gallery-item") || hasClosestByClassName(event.target, "av__gallery-add") ||
|
||||||
hasClosestByClassName(event.target, "av__row") || hasClosestByClassName(event.target, "av__row--util") ||
|
hasClosestByClassName(event.target, "av__row") || hasClosestByClassName(event.target, "av__row--util") ||
|
||||||
hasClosestBlock(event.target);
|
hasClosestBlock(event.target);
|
||||||
if (targetElement && targetElement.getAttribute("data-av-type") === "gallery" && event.target.classList.contains("av__gallery")) {
|
if (targetElement && ["gallery", "kanban"].includes(targetElement.getAttribute("data-av-type")) && event.target.classList.contains("av__gallery")) {
|
||||||
// 拖拽到属性视图 gallery 内,但没选中 item
|
// 拖拽到属性视图 gallery 内,但没选中 item
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1355,18 +1355,31 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// gallery
|
// gallery & kanban
|
||||||
if (targetElement.classList.contains("av__gallery-item")) {
|
if (targetElement.classList.contains("av__gallery-item")) {
|
||||||
const midLeft = nodeRect.left + nodeRect.width / 2;
|
if (hasClosestByClassName(targetElement, "av__kanban-group")) {
|
||||||
if (event.clientX < midLeft && event.clientX > nodeRect.left - 13) {
|
const midTop = nodeRect.top + nodeRect.height / 2;
|
||||||
targetElement.classList.add("dragover__left");
|
if (event.clientY < midTop && event.clientY > nodeRect.top - 13) {
|
||||||
} else if (event.clientX > midLeft && event.clientX <= nodeRect.right + 13) {
|
targetElement.classList.add("dragover__top");
|
||||||
targetElement.classList.add("dragover__right");
|
} else if (event.clientY > midTop && event.clientY <= nodeRect.bottom + 13) {
|
||||||
|
targetElement.classList.add("dragover__bottom");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const midLeft = nodeRect.left + nodeRect.width / 2;
|
||||||
|
if (event.clientX < midLeft && event.clientX > nodeRect.left - 13) {
|
||||||
|
targetElement.classList.add("dragover__left");
|
||||||
|
} else if (event.clientX > midLeft && event.clientX <= nodeRect.right + 13) {
|
||||||
|
targetElement.classList.add("dragover__right");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (targetElement.classList.contains("av__gallery-add")) {
|
if (targetElement.classList.contains("av__gallery-add")) {
|
||||||
targetElement.classList.add("dragover__left");
|
if (hasClosestByClassName(targetElement, "av__kanban-group")) {
|
||||||
|
targetElement.classList.add("dragover__bottom");
|
||||||
|
} else {
|
||||||
|
targetElement.classList.add("dragover__left");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue