mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
This commit is contained in:
parent
62642c0d0f
commit
655d7cd41b
1 changed files with 9 additions and 8 deletions
|
|
@ -233,15 +233,8 @@ export class Outline extends Model {
|
|||
return;
|
||||
}
|
||||
const documentSelf = document;
|
||||
item.style.opacity = "0.38";
|
||||
const ghostElement = item.cloneNode(true) as HTMLElement;
|
||||
this.element.append(ghostElement);
|
||||
ghostElement.setAttribute("id", "dragGhost");
|
||||
ghostElement.firstElementChild.setAttribute("style", "padding-left:4px");
|
||||
ghostElement.setAttribute("style", `border-radius: var(--b3-border-radius);background-color: var(--b3-list-hover);position: fixed; top: ${event.clientY}px; left: ${event.clientX}px; z-index:999997;`);
|
||||
|
||||
documentSelf.ondragstart = () => false;
|
||||
|
||||
let ghostElement: HTMLElement
|
||||
let selectItem: HTMLElement;
|
||||
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
|
||||
if (moveEvent.clientY === event.clientY && moveEvent.clientX === event.clientX) {
|
||||
|
|
@ -249,6 +242,14 @@ export class Outline extends Model {
|
|||
}
|
||||
moveEvent.preventDefault();
|
||||
moveEvent.stopPropagation();
|
||||
if (!ghostElement) {
|
||||
item.style.opacity = "0.38";
|
||||
ghostElement = item.cloneNode(true) as HTMLElement;
|
||||
this.element.append(ghostElement);
|
||||
ghostElement.setAttribute("id", "dragGhost");
|
||||
ghostElement.firstElementChild.setAttribute("style", "padding-left:4px");
|
||||
ghostElement.setAttribute("style", `border-radius: var(--b3-border-radius);background-color: var(--b3-list-hover);position: fixed; top: ${event.clientY}px; left: ${event.clientX}px; z-index:999997;`);
|
||||
}
|
||||
ghostElement.style.top = moveEvent.clientY + "px";
|
||||
ghostElement.style.left = moveEvent.clientX + "px";
|
||||
selectItem = hasClosestByClassName(moveEvent.target as HTMLElement, "b3-list-item") as HTMLElement;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue