Commit graph

73 commits

Author SHA1 Message Date
avi
d2118f080f Fix PDF export to always include the full book
The previous export printed the CodeMirror editor, which only keeps a
virtualized window of lines in the DOM; on larger books the PDF could come
out truncated (only what was rendered around the viewport). Replace the
print path with a dedicated #printBook container: the renderer renders each
chapter of the assembled manuscript to plain HTML with markdown-it, and the
print stylesheet hides the entire app and shows that container instead.
Plain HTML paginates reliably regardless of editor viewport or scroll
position, every chapter after the first still starts on its own page, and
output is a properly formatted manuscript instead of raw markdown. Keep the
screen-only chapter-break separator in the Full Book editor.

Extend the e2e selftest to assert #printBook holds every chapter, is hidden
on screen, and that a 1500-line chapter reaches the print DOM and exported
PDF in full.
2026-08-18 10:41:56 -05:00
avi
778b480ea2 Export Full Book as PDF with automatic chapter page breaks
Print the Full Book window via webContents.printToPDF (A4, 1in margins),
reusing the existing print stylesheet so every chapter after the first
starts on its own page and all app chrome is stripped from the output.
Expose it as an Export PDF button in the Full Book header and a File menu
item, save via a native save dialog (self-test writes to FOLIO_TEST_PDF),
and force light-on-white colors in print so dark-mode exports stay readable.
Add e2e coverage that exports through the real renderer->IPC->print chain
and verifies a valid non-empty PDF is written.
2026-08-18 10:11:06 -05:00
avi
ebbb424ee5 Add automatic chapter page breaks to Full Book 2026-08-18 09:05:05 -05:00
avi
06fa671f84 WIP: preserve recovered Folio packaging and icon work 2026-08-18 08:31:43 -05:00
avi
9b230c0569 Allow copy-move drag feedback for chapter reordering
Set effectAllowed to copyMove in dragstart so Chromium renders a valid
drop cursor over chapter rows on X11 and other platforms (the effective
operation remains move via dropEffect). On native Wayland the prohibited
cursor persists as a known upstream Chromium/Electron platform
limitation; no DOM change can reach it.
2026-08-17 21:02:04 -05:00
avi
424aeab8a1 Fix Full Book view layout so the entire manuscript is scrollable
The Full Book pane had no CSS rule, so it fell back to block layout:
the CodeMirror editor grew to the full manuscript height and was
clipped by the overflow-hidden workspace, leaving the content below
the first screen unreachable and making a multi-chapter book appear
as a single chapter. Give .full-book-view the same flex-column layout
as .chapter-view so the editor is bounded and scrolls internally.

Add an e2e assertion (fbLayoutOk) that checks the computed layout is a
flex column with the editor bounded to the viewport, so this class of
rendering regression is caught in future runs.
2026-08-17 20:17:52 -05:00
avi
6b1a9da5cc Fix Full Book assembly to always render from canonical chapter metadata
Full Book now assembles from a fresh read of the canonical book metadata
(chapter order + chapter entries) instead of the renderer's in-memory
chapter array, so it always contains every chapter in the current order
and can never render from stale or partially-loaded state. The chapter
sidebar and Full Book share the same single source of truth.

Also refresh Full Book whenever book metadata loads, and extend the e2e
scenario to cover reordering to a new order, order persistence across
reopen, and delete/rename/new-empty chapters all being reflected.
2026-08-17 19:33:41 -05:00
avi
46eca18cdf Complete Full Book view: wire Ctrl+A select-all and add e2e coverage
Route the renderer select-all listener (previously sent but never handled) to
the active editor, and extend the e2e scenario to verify the Full Book
assembly, stats, Copy All clipboard content, and read-only select-all.
2026-08-17 18:13:40 -05:00
avi
c7323af38f WIP: save Folio changes before OpenCode restart 2026-08-17 18:02:44 -05:00
avi
11dd692ec4 Add Obsidian-like full-featured editor toolbar 2026-08-17 14:34:36 -05:00
avi
45990bbd62 Add strikethrough shortcut, fenced code toggle, and CodeMirror-aware undo/redo
- Bind Ctrl+Shift+S to strikethrough
- Smart code toggle: fenced block for multi-line selections, inline otherwise
- Link editing: selecting an existing link now selects its URL for editing
- Route undo/redo shortcuts through IPC so CodeMirror history is used when
  the editor has focus instead of Electron's native menu-role undo/redo
- Add Indent/Outdent toolbar buttons
2026-08-17 13:02:42 -05:00
avi
c09f4adc30 Add Markdown formatting toolbar and editor shortcuts 2026-08-17 12:28:49 -05:00
avi
1ae9744b2b Replace split textarea/preview editor with a single CodeMirror Markdown editor 2026-08-17 11:15:23 -05:00
avi
2545dede0b Stop e2e runs polluting recent books and prune recents that no longer exist 2026-08-17 11:15:16 -05:00
avi
17a895dffe Replace unsupported window prompt/confirm/alert with an in-app modal dialog 2026-08-17 11:15:14 -05:00
avi
1d705ac607 Add wikilink support as a markdown-it plugin with unit tests 2026-08-17 11:15:06 -05:00
avi
5dcdec86b9 Stage 6: export book as combined Markdown or ZIP bundle (title page, book.md, chapters/, manifest) with File menu + toolbar entries and export tests 2026-08-17 09:22:41 -05:00
avi
e0c0ceec78 UX: visible drag handle on each chapter row + prominent '+' add button in sidebar header 2026-08-16 15:29:38 -05:00
avi
25baae2950 Stage 5: live Markdown editor (source+preview), autosave, word count, find bar, save-state indicator 2026-08-16 14:51:06 -05:00
avi
4b8d78458c Stage 4: drag-and-drop + keyboard chapter reordering (moveInList), chapters-changed broadcast, DnD/keyboard e2e 2026-08-16 14:43:42 -05:00
avi
d3ab261346 Stage 3: chapter management — create/rename/delete/duplicate, sidebar list, select, read-only preview, word count, IPC + tests + e2e self-test 2026-08-16 14:34:34 -05:00
avi
2862c433bd Stage 2: local project creation — folder dialog, folio.json, recents, menu, book open/new/reveal, welcome UI 2026-08-16 14:11:51 -05:00
avi
6fac0d013b Stage 1: app skeleton — Electron window, sidebar/editor layout, light/dark CSS, esbuild build, typecheck 2026-08-16 13:33:53 -05:00