mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: supply version
param when installing libraries (#4305)
This commit is contained in:
parent
b6ef953dc9
commit
cc4b0c2932
6 changed files with 23 additions and 8 deletions
|
@ -1,6 +1,11 @@
|
|||
import { fileOpen, fileSave } from "./filesystem";
|
||||
import { cleanAppStateForExport, clearAppStateForDatabase } from "../appState";
|
||||
import { EXPORT_DATA_TYPES, EXPORT_SOURCE, MIME_TYPES } from "../constants";
|
||||
import {
|
||||
EXPORT_DATA_TYPES,
|
||||
EXPORT_SOURCE,
|
||||
MIME_TYPES,
|
||||
VERSIONS,
|
||||
} from "../constants";
|
||||
import { clearElementsForDatabase, clearElementsForExport } from "../element";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
||||
|
@ -42,7 +47,7 @@ export const serializeAsJSON = (
|
|||
): string => {
|
||||
const data: ExportedDataState = {
|
||||
type: EXPORT_DATA_TYPES.excalidraw,
|
||||
version: 2,
|
||||
version: VERSIONS.excalidraw,
|
||||
source: EXPORT_SOURCE,
|
||||
elements:
|
||||
type === "local"
|
||||
|
@ -121,7 +126,7 @@ export const isValidLibrary = (json: any) => {
|
|||
export const saveLibraryAsJSON = async (libraryItems: LibraryItems) => {
|
||||
const data: ExportedLibraryData = {
|
||||
type: EXPORT_DATA_TYPES.excalidrawLibrary,
|
||||
version: 2,
|
||||
version: VERSIONS.excalidrawLibrary,
|
||||
source: EXPORT_SOURCE,
|
||||
libraryItems,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types";
|
||||
import type { cleanAppStateForExport } from "../appState";
|
||||
import { VERSIONS } from "../constants";
|
||||
|
||||
export interface ExportedDataState {
|
||||
type: string;
|
||||
|
@ -24,7 +25,7 @@ export interface ImportedDataState {
|
|||
|
||||
export interface ExportedLibraryData {
|
||||
type: string;
|
||||
version: 2;
|
||||
version: typeof VERSIONS.excalidrawLibrary;
|
||||
source: string;
|
||||
libraryItems: LibraryItems;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue