15 lines
975 B
TypeScript
15 lines
975 B
TypeScript
// Bundled (esbuild) by scripts/e2e-canvas-parity.mjs and run in Node: renders what a publish
|
|||
|
|
// of the CURRENT stored state would emit, composed like TopBar's Preview
|
||
|
|
// (header + body + footer under the real document head). Used for specs whose
|
||
|
|
// checked-in published HTML is stale relative to the stored state.
|
||
|
|
import { exportBodyHtml, exportComposedPreviewHtml } from '../src/utils/html-export';
|
||
|
|
|
||
|
|
export function renderPublished(project: any, pageIdx: number): string {
|
||
|
|
const page = project.pages_craft_state[pageIdx];
|
||
|
|
const hdr = project.header_craft_state ? exportBodyHtml(project.header_craft_state, 'header').html : '';
|
||
|
|
const ftr = project.footer_craft_state ? exportBodyHtml(project.footer_craft_state, 'footer').html : '';
|
||
|
|
const body = exportBodyHtml(page.craftState).html;
|
||
|
|
return exportComposedPreviewHtml(page.craftState, hdr + body + ftr, {
|
||
|
|
title: page.name, includeFonts: true, headCode: project.design?.headCode, design: project.design,
|
||
|
|
});
|
||
|
|
}
|