| 348 | }; |
| 349 | |
| 350 | export const generateHTMLPreview = async ( |
| 351 | nodes: SceneNode[], |
| 352 | settings: PluginSettings, |
| 353 | ): Promise<HTMLPreview> => { |
| 354 | let result = await htmlMain( |
| 355 | nodes, |
| 356 | { |
| 357 | ...settings, |
| 358 | htmlGenerationMode: "html", |
| 359 | }, |
| 360 | nodes.length > 1 ? false : true, |
| 361 | ); |
| 362 | |
| 363 | if (nodes.length > 1) { |
| 364 | result.html = `<div style="width: 100%; height: 100%">${result.html}</div>`; |
| 365 | } |
| 366 | |
| 367 | return { |
| 368 | size: { |
| 369 | width: Math.max(...nodes.map((node) => node.width)), |
| 370 | height: nodes.reduce((sum, node) => sum + node.height, 0), |
| 371 | }, |
| 372 | content: result.html, |
| 373 | }; |
| 374 | }; |
| 375 | |
| 376 | const htmlWidgetGenerator = async ( |
| 377 | sceneNode: ReadonlyArray<SceneNode>, |