fix: issues when importing package outside of browser (#9525)

This commit is contained in:
Marcel Mraz
2025-05-14 16:01:43 +02:00
committed by GitHub
parent 0a534f1bc6
commit d92a849038
8 changed files with 23 additions and 12 deletions
@@ -5,10 +5,10 @@ import { useCallback, useEffect, useRef, useState } from "react";
import {
EDITOR_LS_KEYS,
EXPORT_DATA_TYPES,
EXPORT_SOURCE,
MIME_TYPES,
VERSIONS,
chunk,
getExportSource,
} from "@excalidraw/common";
import { EditorLocalStorage } from "../data/EditorLocalStorage";
@@ -281,7 +281,7 @@ const PublishLibrary = ({
const libContent: ExportedLibraryData = {
type: EXPORT_DATA_TYPES.excalidrawLibrary,
version: VERSIONS.excalidrawLibrary,
source: EXPORT_SOURCE,
source: getExportSource(),
libraryItems: clonedLibItems,
};
const content = JSON.stringify(libContent, null, 2);
+3 -3
View File
@@ -1,7 +1,7 @@
import {
DEFAULT_FILENAME,
EXPORT_DATA_TYPES,
EXPORT_SOURCE,
getExportSource,
MIME_TYPES,
VERSIONS,
} from "@excalidraw/common";
@@ -56,7 +56,7 @@ export const serializeAsJSON = (
const data: ExportedDataState = {
type: EXPORT_DATA_TYPES.excalidraw,
version: VERSIONS.excalidraw,
source: EXPORT_SOURCE,
source: getExportSource(),
elements:
type === "local"
? clearElementsForExport(elements)
@@ -142,7 +142,7 @@ export const serializeLibraryAsJSON = (libraryItems: LibraryItems) => {
const data: ExportedLibraryData = {
type: EXPORT_DATA_TYPES.excalidrawLibrary,
version: VERSIONS.excalidrawLibrary,
source: EXPORT_SOURCE,
source: getExportSource(),
libraryItems,
};
return JSON.stringify(data, null, 2);