Explorar el Código

:art: Improve database template empty date rendering https://github.com/siyuan-note/siyuan/issues/10830

Vanessa hace 1 año
padre
commit
299437d751
Se han modificado 2 ficheros con 12 adiciones y 3 borrados
  1. 10 1
      app/src/boot/globalEvent/click.ts
  2. 2 2
      app/src/layout/dock/Outline.ts

+ 10 - 1
app/src/boot/globalEvent/click.ts

@@ -6,7 +6,16 @@ import {writeText} from "../../protyle/util/compatibility";
 import {showMessage} from "../../dialog/message";
 import {showMessage} from "../../dialog/message";
 
 
 export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
 export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
-    document.getElementById("dragGhost")?.remove();
+    const ghostElement = document.getElementById("dragGhost")
+    if (ghostElement) {
+        const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement
+        startElement ? startElement.style.opacity = "" : ""
+        ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => {
+            item.classList.remove("dragover__top", "dragover__bottom", "dragover");
+            item.style.opacity = ""
+        });
+        ghostElement.remove();
+    }
     if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) {
     if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) {
         if (getSelection().rangeCount > 0 && window.siyuan.menus.menu.element.contains(getSelection().getRangeAt(0).startContainer) &&
         if (getSelection().rangeCount > 0 && window.siyuan.menus.menu.element.contains(getSelection().getRangeAt(0).startContainer) &&
             window.siyuan.menus.menu.element.contains(document.activeElement)) {
             window.siyuan.menus.menu.element.contains(document.activeElement)) {

+ 2 - 2
app/src/layout/dock/Outline.ts

@@ -235,8 +235,8 @@ export class Outline extends Model {
             const documentSelf = document;
             const documentSelf = document;
             item.style.opacity = "0.38";
             item.style.opacity = "0.38";
             const ghostElement = item.cloneNode(true) as HTMLElement;
             const ghostElement = item.cloneNode(true) as HTMLElement;
-            document.body.append(ghostElement);
-            ghostElement.dataset.id = "dragGhost"
+            this.element.append(ghostElement);
+            ghostElement.setAttribute("id", "dragGhost");
             ghostElement.firstElementChild.setAttribute("style", "padding-left:4px");
             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.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;`);