{#each pages as p} {#each ['header', 'footer'] as const as zone} {#if !(hfActive === zone && editingPage === p)} {@const html = zone === 'header' ? headerHtml : footerHtml}
startEdit(zone, p)} role="button" tabindex="-1" use:patchFields={[p, numPages, html]} > {@html html}
{/if} {/each} {/each} {#if hfActive} {@const box = zoneBox(hfActive, editingPage)}
Insert
e.preventDefault()} onclick={() => insertField('pageNumber')}>Page number
e.preventDefault()} onclick={() => insertField('pageCount')}>Page count
e.preventDefault()} onclick={() => (hfActive = null)}>Done
{/if}