Parcourir la source

:art: https://github.com/siyuan-note/siyuan/issues/11880

Vanessa il y a 10 mois
Parent
commit
6ff4b621b2

+ 4 - 1
app/src/protyle/render/av/cell.ts

@@ -498,8 +498,11 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
     avMaskElement.addEventListener("contextmenu", (event) => {
         removeAvMask(event);
     });
-    avMaskElement.addEventListener("mousedown", (event:MouseEvent) => {
+    avMaskElement.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => {
         if (event.button === 1) {
+            if (event.target.classList.contains("av__mask") && document.activeElement && document.activeElement.nodeType === 1) {
+                (document.activeElement as HTMLElement).blur();
+            }
             removeAvMask(event);
         }
     });

+ 5 - 0
app/src/protyle/render/av/openMenuPanel.ts

@@ -488,6 +488,11 @@ export const openMenuPanel = (options: {
                 window.siyuan.dragElement = undefined;
             }
         });
+        avPanelElement.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => {
+            if (event.button === 1 && !hasClosestByClassName(event.target, "b3-menu")) {
+                document.querySelector(".av__panel").dispatchEvent(new CustomEvent("click", {detail: "close"}));
+            }
+        });
         avPanelElement.addEventListener("click", (event: MouseEvent) => {
             let type: string;
             if (typeof event.detail === "string") {