make fileId mandatory for image and export convertToExcalidrawElements

This commit is contained in:
Aakansha Doshi 2023-07-18 13:03:59 +05:30
parent a6b389ca62
commit 756b924518
4 changed files with 6 additions and 3 deletions

View file

@ -32,6 +32,7 @@ import {
ExcalidrawLinearElement, ExcalidrawLinearElement,
ExcalidrawSelectionElement, ExcalidrawSelectionElement,
ExcalidrawTextElement, ExcalidrawTextElement,
FileId,
FontFamilyValues, FontFamilyValues,
TextAlign, TextAlign,
VerticalAlign, VerticalAlign,
@ -154,6 +155,7 @@ export type ExcalidrawProgrammaticElement =
type: Extract<ExcalidrawImageElement["type"], "image">; type: Extract<ExcalidrawImageElement["type"], "image">;
x: number; x: number;
y: number; y: number;
fileId: FileId;
} & Partial<ExcalidrawImageElement>); } & Partial<ExcalidrawImageElement>);
export interface ExcalidrawProgrammaticAPI { export interface ExcalidrawProgrammaticAPI {

View file

@ -31,7 +31,6 @@ import { ImportedLibraryData } from "../../../data/types";
import CustomFooter from "./CustomFooter"; import CustomFooter from "./CustomFooter";
import MobileFooter from "./MobileFooter"; import MobileFooter from "./MobileFooter";
import { KEYS } from "../../../keys"; import { KEYS } from "../../../keys";
import { convertToExcalidrawElements } from "../../../data/transform";
declare global { declare global {
interface Window { interface Window {
@ -76,6 +75,7 @@ const {
WelcomeScreen, WelcomeScreen,
MainMenu, MainMenu,
LiveCollaborationTrigger, LiveCollaborationTrigger,
convertToExcalidrawElements,
} = window.ExcalidrawLib; } = window.ExcalidrawLib;
const COMMENT_ICON_DIMENSION = 32; const COMMENT_ICON_DIMENSION = 32;

View file

@ -32,8 +32,8 @@ const elements: ExcalidrawProgrammaticAPI["elements"] = [
type: "image", type: "image",
x: 606.1042326312408, x: 606.1042326312408,
y: 153.57729779411773, y: 153.57729779411773,
width: 231.30325348751828, width: 230,
height: 231.64340533088227, height: 230,
fileId: "rocket" as FileId, fileId: "rocket" as FileId,
}, },
]; ];

View file

@ -249,3 +249,4 @@ export { LiveCollaborationTrigger };
export { DefaultSidebar } from "../../components/DefaultSidebar"; export { DefaultSidebar } from "../../components/DefaultSidebar";
export { normalizeLink } from "../../data/url"; export { normalizeLink } from "../../data/url";
export { convertToExcalidrawElements } from "../../data/transform";