support embedding scene data to PNG/SVG (#2219)
Co-authored-by: Lipis <lipiridis@gmail.com>
This commit is contained in:
@ -6,6 +6,7 @@ import { fileOpen, fileSave } from "browser-nativefs";
|
||||
import { loadFromBlob } from "./blob";
|
||||
import { loadLibrary } from "./localStorage";
|
||||
import { Library } from "./library";
|
||||
import { MIME_TYPES } from "../constants";
|
||||
|
||||
export const serializeAsJSON = (
|
||||
elements: readonly ExcalidrawElement[],
|
||||
@ -48,8 +49,8 @@ export const saveAsJSON = async (
|
||||
export const loadFromJSON = async (localAppState: AppState) => {
|
||||
const blob = await fileOpen({
|
||||
description: "Excalidraw files",
|
||||
extensions: [".json", ".excalidraw"],
|
||||
mimeTypes: ["application/json"],
|
||||
extensions: [".json", ".excalidraw", ".png", ".svg"],
|
||||
mimeTypes: ["application/json", "image/png", "image/svg+xml"],
|
||||
});
|
||||
return loadFromBlob(blob, localAppState);
|
||||
};
|
||||
@ -76,7 +77,7 @@ export const saveLibraryAsJSON = async () => {
|
||||
);
|
||||
const fileName = "library.excalidrawlib";
|
||||
const blob = new Blob([serialized], {
|
||||
type: "application/vnd.excalidrawlib+json",
|
||||
type: MIME_TYPES.excalidrawlib,
|
||||
});
|
||||
await fileSave(blob, {
|
||||
fileName,
|
||||
|
Reference in New Issue
Block a user