Two print-ready A4 templates share the same shell. Switching templates starts a new document of that type (after saving the current one if needed).
| Template | Module | Content shape |
|---|---|---|
| Letter | editor/js/letter-sheet.js |
Plain text across page cards |
| Diary | editor/js/diary-sheet.js |
FIR header + pages with left/right columns |
Rich text helpers for both templates live in editor/js/quill-pages.js.
flowchart TD
edit[Edit_on_screen]
spill[Overflow_spills_to_next_page]
pdfBtn[PDF_button_or_Ctrl_P]
sync[Sync_live_model]
route[Platform_router]
clone[Shared_print_document]
native[Desktop_native_print]
raster[iOS_raster_A4_PDF]
save[User_saves_or_shares_PDF]
edit --> spill
edit --> pdfBtn
pdfBtn --> sync
sync --> route
route -->|desktop_Android| native
route -->|iOS_iPadOS| raster
native --> clone
raster --> clone
native --> save
raster --> save
- On screen: pages may be scaled to fit the window (Page preview). Scaling is visual only.
- Shared print document: both export backends use
editor/js/export/print-document.js(buildPrintDocumentHtml/mountPrintDocument) so line wrapping matches the editor. - Desktop / Android: native browser print dialog from the hidden iframe (
triggerNativePrint). Prefer Save as PDF with A4 and default margins. - iOS / iPadOS: WebKit’s print pipeline clips full-bleed A4 cards, so export builds a raster A4 PDF (
editor/js/export/raster-pdf.js) from the same print-document cards (html2canvas + jsPDF). Text in that PDF is not selectable; visual completeness is the goal. Verify on a real iPhone/iPad — desktop Playwright WebKit does not reproduce iOS Quartz print. - Delivery order (iOS): generate the blob first, then Web Share sheet → download anchor → same-tab navigation. Never open a tab before generation: backgrounding the editor tab throttles rendering and stalls rasterization, which shows up as a permanently blank
about:blanktab.
Routing lives in editor/js/export/router.js; the UI entry point is handleDocumentExport() in editor/js/main.js, which calls runDocumentExport().
Deprecated rebuild helpers (diaryPagesHtml / letterPagesHtml and matching print CSS) remain in the sheet modules for rollback only; export no longer calls them.
Diary extras: Hide/Show header per page, Add page, delete page. Letter uses continuous page spill when text overflows.