20 lines
757 B
JavaScript
20 lines
757 B
JavaScript
// src/initExcalidraw.js
|
|
// Helper to initialize Excalidraw in a SolidJS environment.
|
|
// We import the necessary modules from 'excalidraw' and create the editor.
|
|
import { initializeApp, importFromLocalStorage } from "@excalidraw/excalidraw";
|
|
|
|
export async function initializeExcalidraw(container, { initialData }) {
|
|
// In a real scenario, you'd use the official Excalidraw package API.
|
|
// The pseudo code below assumes a function `initializeApp` that returns { app, api }.
|
|
// Check Excalidraw docs for actual integration steps.
|
|
|
|
const { app, api } = await initializeApp({
|
|
target: container,
|
|
// initialData may be: { elements, appState, ... }
|
|
initialData: initialData || {},
|
|
UIOptions: { dockedSidebar: true },
|
|
});
|
|
|
|
return api;
|
|
}
|