@@ -8,7 +8,11 @@ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
88import { EditorLocalStorage } from "../../data/EditorLocalStorage" ;
99import { canvasToBlob } from "../../data/blob" ;
1010import { t } from "../../i18n" ;
11- import { convertToExcalidrawElements , exportToCanvas } from "../../index" ;
11+ import {
12+ convertToExcalidrawElements ,
13+ exportToCanvas ,
14+ THEME ,
15+ } from "../../index" ;
1216
1317import type { AppClassProperties , BinaryFiles } from "../../types" ;
1418
@@ -95,17 +99,21 @@ export const convertMermaidToExcalidraw = async ({
9599 } ;
96100
97101 const canvas = await exportToCanvas ( {
98- elements : data . current . elements ,
99- files : data . current . files ,
100- exportPadding : DEFAULT_EXPORT_PADDING ,
101- maxWidthOrHeight :
102- Math . max ( parent . offsetWidth , parent . offsetHeight ) *
103- window . devicePixelRatio ,
104- appState : {
102+ data : {
103+ elements : data . current . elements ,
104+ files : data . current . files ,
105+ } ,
106+ config : {
105107 // TODO hack (will be refactored in TTD v2)
106- exportWithDarkMode : document
108+ theme : document
107109 . querySelector ( ".excalidraw-container" )
108- ?. classList . contains ( "theme--dark" ) ,
110+ ?. classList . contains ( "theme--dark" )
111+ ? THEME . DARK
112+ : THEME . LIGHT ,
113+ padding : DEFAULT_EXPORT_PADDING ,
114+ maxWidthOrHeight :
115+ Math . max ( parent . offsetWidth , parent . offsetHeight ) *
116+ window . devicePixelRatio ,
109117 } ,
110118 } ) ;
111119 // if converting to blob fails, there's some problem that will
0 commit comments