mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
27030446f6
commit
a4da241168
2 changed files with 16 additions and 4 deletions
|
|
@ -284,6 +284,18 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isBottom: boolean,
|
||||
direct: "col" | "row", isCopy: boolean) => {
|
||||
const isSameDoc = protyle.element.contains(sourceElements[0]);
|
||||
// 把列表块中的唯一一个列表项块拖拽到列表块的左侧 https://github.com/siyuan-note/siyuan/issues/16315
|
||||
if (isSameDoc && sourceElements[0].classList.contains("li") && targetElement === sourceElements[0].parentElement &&
|
||||
targetElement.childElementCount === sourceElements.length + 1) {
|
||||
const outLiElement = sourceElements.find((element) => {
|
||||
if (!targetElement.contains(element)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!outLiElement) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const undoOperations: IOperation[] = [];
|
||||
const targetMoveUndo: IOperation = {
|
||||
action: "move",
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ export const getTopEmptyElement = (element: Element) => {
|
|||
|
||||
export const getTopAloneElement = (topSourceElement: Element) => {
|
||||
if ("NodeBlockquote" === topSourceElement.parentElement.getAttribute("data-type") && topSourceElement.parentElement.childElementCount === 2) {
|
||||
while (!topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
while (topSourceElement.parentElement && !topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
if (topSourceElement.parentElement.getAttribute("data-type") === "NodeBlockquote" && topSourceElement.parentElement.childElementCount === 2) {
|
||||
topSourceElement = topSourceElement.parentElement;
|
||||
} else {
|
||||
|
|
@ -127,7 +127,7 @@ export const getTopAloneElement = (topSourceElement: Element) => {
|
|||
}
|
||||
}
|
||||
} else if ("NodeSuperBlock" === topSourceElement.parentElement.getAttribute("data-type") && topSourceElement.parentElement.childElementCount === 2) {
|
||||
while (!topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
while (topSourceElement.parentElement && !topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
if (topSourceElement.parentElement.getAttribute("data-type") === "NodeSuperBlock" && topSourceElement.parentElement.childElementCount === 2) {
|
||||
topSourceElement = topSourceElement.parentElement;
|
||||
} else {
|
||||
|
|
@ -136,7 +136,7 @@ export const getTopAloneElement = (topSourceElement: Element) => {
|
|||
}
|
||||
}
|
||||
} else if ("NodeListItem" === topSourceElement.parentElement.getAttribute("data-type") && topSourceElement.parentElement.childElementCount === 3) {
|
||||
while (!topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
while (topSourceElement.parentElement && !topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
if (topSourceElement.parentElement.getAttribute("data-type") === "NodeListItem" && topSourceElement.parentElement.childElementCount === 3) {
|
||||
topSourceElement = topSourceElement.parentElement;
|
||||
} else if (topSourceElement.parentElement.getAttribute("data-type") === "NodeList" && topSourceElement.parentElement.childElementCount === 2) {
|
||||
|
|
@ -147,7 +147,7 @@ export const getTopAloneElement = (topSourceElement: Element) => {
|
|||
}
|
||||
}
|
||||
} else if ("NodeList" === topSourceElement.parentElement.getAttribute("data-type") && topSourceElement.parentElement.childElementCount === 2) {
|
||||
while (!topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
while (topSourceElement.parentElement && !topSourceElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
if ("NodeList" === topSourceElement.parentElement.getAttribute("data-type") && topSourceElement.parentElement.childElementCount === 2) {
|
||||
topSourceElement = topSourceElement.parentElement;
|
||||
} else if (topSourceElement.parentElement.getAttribute("data-type") === "NodeListItem" && topSourceElement.parentElement.childElementCount === 3) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue