mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-06-27 22:36:00 +00:00
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user