This commit is contained in:
zsviczian
2024-10-13 20:59:43 +02:00
parent 4e2d7eb637
commit fc0ac92dd3
9 changed files with 46 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ import { FILENAMEPARTS, PreviewImageType } from "./utils/UtilTypes";
import { CustomMutationObserver, debug, DEBUGGING } from "./utils/DebugHelper";
import { getExcalidrawFileForwardLinks } from "./utils/ExcalidrawViewUtils";
import { linkPrompt } from "./dialogs/Prompt";
import { isHTMLElement } from "./utils/typechecks";
interface imgElementAttributes {
file?: TFile;
@@ -405,12 +406,13 @@ const createImgElement = async (
let timer:number;
const clickEvent = (ev:PointerEvent) => {
if(!(ev.target instanceof Element)) {
if (!isHTMLElement(ev.target)) {
return;
}
const containerElement = ev.target.hasClass("excalidraw-embedded-img")
const targetElement = ev.target as HTMLElement;
const containerElement = targetElement.hasClass("excalidraw-embedded-img")
? ev.target
: getParentOfClass(ev.target, "excalidraw-embedded-img");
: getParentOfClass(targetElement, "excalidraw-embedded-img");
if (!containerElement) {
return;
}