Browse Source

improvement: Tweak error message on image import (#2619)

* improvement: tweak error message on image import

* tweak copy
David Luzar 4 years ago
parent
commit
b997e69ebc
4 changed files with 11 additions and 3 deletions
  1. 8 1
      src/components/ErrorDialog.tsx
  2. 1 1
      src/data/blob.ts
  3. 1 1
      src/locales/en.json
  4. 1 0
      src/packages/excalidraw/CHANGELOG.md

+ 8 - 1
src/components/ErrorDialog.tsx

@@ -28,7 +28,14 @@ export const ErrorDialog = ({
           onCloseRequest={handleClose}
           title={t("errorDialog.title")}
         >
-          <div>{message}</div>
+          <div>
+            {message.split("\n").map((line) => (
+              <>
+                {line}
+                <br />
+              </>
+            ))}
+          </div>
         </Dialog>
       )}
     </>

+ 1 - 1
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") {

+ 1 - 1
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": {

+ 1 - 0
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)