This commit is contained in:
zsviczian 2025-04-09 17:57:51 +02:00 committed by GitHub
commit a1b0c5b8c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9983,13 +9983,23 @@ class App extends React.Component<AppProps, AppState> {
this.state,
);
const imageFile = await fileOpen({
let imageFile = await fileOpen({
description: "Image",
extensions: Object.keys(
IMAGE_MIME_TYPES,
) as (keyof typeof IMAGE_MIME_TYPES)[],
});
//maybe temporary fix: https://github.com/excalidraw/excalidraw/issues/9091
if (imageFile && !imageFile.type) {
const extension = imageFile.name.split(".").pop()?.toLowerCase();
const mimeType =
IMAGE_MIME_TYPES[extension as keyof typeof IMAGE_MIME_TYPES];
if (mimeType) {
imageFile = new File([imageFile], imageFile.name, { type: mimeType });
}
}
const imageElement = this.createImageElement({
sceneX: x,
sceneY: y,