Browse Source

fix: unable to change color while in wysiwyg

dwelle 1 năm trước cách đây
mục cha
commit
292a869ee4

+ 2 - 2
packages/excalidraw/element/textWysiwyg.tsx

@@ -562,7 +562,7 @@ export const textWysiwyg = ({
 
 
     window.removeEventListener("resize", updateWysiwygStyle);
     window.removeEventListener("resize", updateWysiwygStyle);
     window.removeEventListener("wheel", stopEvent, true);
     window.removeEventListener("wheel", stopEvent, true);
-    window.removeEventListener("pointerdown", onPointerDown);
+    window.removeEventListener("pointerdown", onPointerDown, { capture: true });
     window.removeEventListener("pointerup", bindBlurEvent);
     window.removeEventListener("pointerup", bindBlurEvent);
     window.removeEventListener("blur", handleSubmit);
     window.removeEventListener("blur", handleSubmit);
     window.removeEventListener("beforeunload", handleSubmit);
     window.removeEventListener("beforeunload", handleSubmit);
@@ -644,7 +644,7 @@ export const textWysiwyg = ({
       window.addEventListener("blur", handleSubmit);
       window.addEventListener("blur", handleSubmit);
     } else if (
     } else if (
       event.target instanceof HTMLElement &&
       event.target instanceof HTMLElement &&
-      !event.target.contains(editable) &&
+      event.target.nodeName === "CANVAS" &&
       // Vitest simply ignores stopPropagation, capture-mode, or rAF
       // Vitest simply ignores stopPropagation, capture-mode, or rAF
       // so without introducing crazier hacks, nothing we can do
       // so without introducing crazier hacks, nothing we can do
       !isTestEnv()
       !isTestEnv()