From b997e69ebcbd13d1d5be31f1003722ba99af1828 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Sun, 20 Dec 2020 16:11:44 +0100 Subject: [PATCH] improvement: Tweak error message on image import (#2619) * improvement: tweak error message on image import * tweak copy --- src/components/ErrorDialog.tsx | 9 ++++++++- src/data/blob.ts | 2 +- src/locales/en.json | 2 +- src/packages/excalidraw/CHANGELOG.md | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/ErrorDialog.tsx b/src/components/ErrorDialog.tsx index 10dce46d..f10c7189 100644 --- a/src/components/ErrorDialog.tsx +++ b/src/components/ErrorDialog.tsx @@ -28,7 +28,14 @@ export const ErrorDialog = ({ onCloseRequest={handleClose} title={t("errorDialog.title")} > -
{message}
+
+ {message.split("\n").map((line) => ( + <> + {line} +
+ + ))} +
)} diff --git a/src/data/blob.ts b/src/data/blob.ts index 73692879..e73b367b 100644 --- a/src/data/blob.ts +++ b/src/data/blob.ts @@ -9,7 +9,7 @@ import { AppState } from "../types"; import { restore } from "./restore"; import { ImportedDataState, LibraryData } from "./types"; -export const parseFileContents = async (blob: Blob | File) => { +const parseFileContents = async (blob: Blob | File) => { let contents: string; if (blob.type === "image/png") { diff --git a/src/locales/en.json b/src/locales/en.json index 70819cdd..74c9d7b4 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -136,7 +136,7 @@ "loadSceneOverridePrompt": "Loading external drawing will replace your existing content. Do you wish to continue?", "errorLoadingLibrary": "There was an error loading the third party library.", "confirmAddLibrary": "This will add {{numShapes}} shape(s) to your library. Are you sure?", - "imageDoesNotContainScene": "Image file doesn't contain scene data. Have you enabled this during export?", + "imageDoesNotContainScene": "Importing images isn't supported at the moment.\n\nDid you want to import a scene? This image does not seem to contain any scene data. Have you enabled this during export?", "cannotRestoreFromImage": "Scene couldn't be restored from this image file" }, "toolBar": { diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md index 24e4be6a..e5aec1ff 100644 --- a/src/packages/excalidraw/CHANGELOG.md +++ b/src/packages/excalidraw/CHANGELOG.md @@ -38,6 +38,7 @@ Please add the latest change on the top under the correct section. ### Improvements +- Improve error message around importing images [#2619](https://github.com/excalidraw/excalidraw/pull/2619) - Add tooltip with icon for embedding scenes [#2532](https://github.com/excalidraw/excalidraw/pull/2532) - RTL support for the stats dialog [#2530](https://github.com/excalidraw/excalidraw/pull/2530) - Expand canvas padding based on zoom. [#2515](https://github.com/excalidraw/excalidraw/pull/2515)