Vanessa
2026-04-07 16:40:31 +08:00
parent 03a0e822a3
commit d3fa65d72c
2 changed files with 19 additions and 4 deletions

View File

@@ -2,17 +2,32 @@ import {getAllEditor, getAllModels} from "../../layout/getAll";
import {isWindow} from "../../util/functions";
import {hasClosestBlock, hasClosestByClassName, hasClosestByTag} from "../../protyle/util/hasClosest";
import {getColIndex} from "../../protyle/util/table";
import {getFirstBlock} from "../../protyle/wysiwyg/getBlock";
const getRightBlock = (element: HTMLElement, x: number, y: number) => {
let index = 1;
let left = x + 34;
let nodeElement = element;
if (nodeElement && nodeElement.classList.contains("protyle-action")) {
return nodeElement;
}
while (nodeElement && (nodeElement.classList.contains("list") || nodeElement.classList.contains("li"))) {
nodeElement = document.elementFromPoint(x + 73 * index, y) as HTMLElement;
nodeElement = document.elementFromPoint(left, y) as HTMLElement;
nodeElement = hasClosestBlock(nodeElement) as HTMLElement;
index++;
if (nodeElement) {
if (nodeElement.classList.contains("bq")) {
nodeElement = nodeElement.firstElementChild as HTMLElement;
} else if (nodeElement.classList.contains("callout")) {
if (y > nodeElement.firstElementChild.getBoundingClientRect().bottom) {
nodeElement = getFirstBlock(nodeElement) as HTMLElement;
} else {
nodeElement = nodeElement.firstElementChild as HTMLElement;
}
} else {
left += 34;
}
} else {
left += 34;
}
}
return nodeElement;
};

View File

@@ -2618,7 +2618,7 @@ data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" d
if (type === "NodeListItem" && nodeElement.childElementCount > 3 || type === "NodeHeading") {
const fold = nodeElement.getAttribute("fold");
foldHTML = `<button class="ariaLabel" data-position="parentW" aria-label="${window.siyuan.languages.fold}"
data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold === "1" ? "" : ";transform:rotate(90deg)"}"><use xlink:href="#iconPlay"></use></svg></button>`;
data-type="fold" style="cursor:inherit;"><svg style="width: 10px;${fold && fold === "1" ? "" : "transform:rotate(90deg)"}"><use xlink:href="#iconPlay"></use></svg></button>`;
}
if (type === "NodeListItem" || type === "NodeList") {
listItem = nodeElement;