Commit graph

85 commits

Author SHA1 Message Date
avi
3052e335a3 Add white/black Folio icon variants and theme-aware in-app icon
- Recolor the in-app glyph (Design B) to a solid white master and generate a
  black variant; the desktop/app icon set (build/icons) is now the white
  master at all sizes (verified bundled white in the AppImage/deb)
- In-app icon switches with the existing data-theme: black in Light mode
  (visible on the light panel) and white in Dark mode (visible on the
  near-black panel); the desktop/application icon stays white
2026-08-20 13:02:19 -05:00
avi
beaf8715d8 Add whole-book vs selected-chapters export workflow
- Export menu (PDF/DOCX/ODT) opens a workflow to export the entire book or
  only selected chapters, with a canonical-order checklist + Select/Clear All
- Selected exports pass an ordered chapter list through the shared pipeline so
  output follows book order (not click order); empty selection is rejected
- Filenames use a ' - Selected Chapters' suffix for partial exports
- PDF renders only the chosen chapters into the print container; DOCX/ODT build
  from the selected chapters in order
2026-08-20 12:20:23 -05:00
avi
7037cd9fc0 Improve the export pipeline (shared ordering + chapter page breaks)
- buildDocx/buildOdt now accept an explicit ordered chapter list, making that
  list the single source of truth for export ordering (defaults to whole book)
- Emit real page breaks between chapters in DOCX, with none before the first
- Unify the DOCX/ODT handlers into one exportOffice pipeline (ODT still built
  from the same DOCX via LibreOffice)
2026-08-20 11:44:54 -05:00
avi
7bdddf32b2 Add document/editor zoom controls
- Persist an app-wide zoom percentage (not per book) and apply it only to the
  writing view (.editor-panes) so the sidebar/navigation stay fixed size
- Add a [-] [100%] [+] control to the chapter and Full Book headers, with a
  click-to-reset level button
- Route Ctrl/Cmd+=, Ctrl/Cmd+-, and Ctrl/Cmd+0 to zoom in/out/reset,
  intercepting the browser's native zoom
2026-08-20 11:25:28 -05:00
avi
946a2967db Add chapter color customization
- Store an optional accent color on each ChapterEntry so it persists with the
  chapter across switching, reordering, close/reopen, and restart
- Add a per-row color button that opens a palette popover (assign / change /
  remove) and shows a small color dot in the sidebar, readable in Light/Dark
- Expose setChapterColor through the main/preload IPC bridge
2026-08-20 11:21:14 -05:00
avi
786a65ae2a Replace markdown editor with native Tiptap editor and add Home navigation
- Migrate renderer from md-editor/md-format to a Tiptap-based native editor
  (native-doc pipeline: native-doc, markdown-to-native, native-to-markdown,
  native-assembly, migration, backup)
- Use pointer-event-based chapter reordering with grab/grabbing cursors to
  avoid the Wayland prohibited-drop cursor while preserving reordering
- Add a persistent Home button that closes the open book and returns to the
  Folio library/welcome screen
- Update app icons, package deps, theme styles, and tests
2026-08-20 11:12:17 -05:00
avi
0df26d4ce6 Match the editor's spacing in PDF/DOCX/ODT and fix the toolbar dropdown
Exports now use the same typography as the Full Book editor — Georgia
serif at 12pt, 1.7 line spacing, and a blank-line gap between paragraphs -
so the on-screen editor and every exported format look consistent. DOCX/
ODT also gain a chapter break before each chapter after the first.
2026-08-18 18:39:21 -05:00
avi
247f16baa5 Add a built-in Light theme
Replaces the old Default theme (which followed the OS color scheme) with a
fixed warm, writing-focused Light theme: off-white editor surface, charcoal
text, subtle warm-gray borders, and a restrained deep teal-green accent. The
selector now offers Light and Neonflux. Old saves storing "default" are
migrated to "light" in both the renderer and the main process, and the e2e
scenario now covers Light + Neonflux application, light/dark checks, theme
round-trips, and content preservation.
2026-08-18 17:15:10 -05:00
avi
6679294231 Add DOCX and ODT export for the Full Book view
The main process now assembles the manuscript from the chapter files and
renders it to a Word document with the docx library, using the same
markdown-it plugin set as the on-screen renderer (highlight, callouts,
wikilinks). ODT is converted from that DOCX with LibreOffice running
headless, keeping the two formats consistent; a clear error is returned
when LibreOffice is missing. The Full Book header's single Export PDF
button becomes an Export menu (PDF/DOCX/ODT) wired to the File menu.

Tests: new run-office-export-test.mjs verifies DOCX/ODT structure,
chapter order and formatting; the e2e scenario exports through the real
IPC chain and checks magic bytes, extensions and the status notices.
2026-08-18 17:06:32 -05:00
avi
ad0329bbf9 Add a reusable theme system with a Neonflux theme
Introduce a theme layer on top of the existing CSS custom properties.
All color tokens now live in themes.css, scoped by a data-theme
attribute on <html>, so a theme is just a new token block plus a
dropdown option - no code changes needed. The Default theme preserves
the existing light/dark behavior; Neonflux adds an electric-cyan dark
theme.

The active theme is chosen via a Theme selector in the sidebar footer
and persisted in a new main-process settings file (userData
settings.json) through getTheme/setTheme IPC, so it survives restarts.
Hard-coded on-accent, selection, shadow and backdrop colors across the
renderer were converted to semantic tokens so every theme stays
consistent.
2026-08-18 12:42:09 -05:00
avi
7011d0655b Add chapter navigation to the Full Book view
Add a chapter dropdown plus Previous/Next buttons to the Full Book
toolbar. The dropdown lists every chapter in canonical order and the
buttons jump between them, scrolling the assembled manuscript so the
target chapter begins near the top of the viewport. Manual scrolling
keeps the dropdown in sync with the chapter currently on screen, and
reordering chapters while Full Book is open re-renders navigation to
match the new order immediately.

Navigation reuses the same chapter boundaries that drive page breaks,
so it can never drift from the assembled chapter order.
2026-08-18 12:40:57 -05:00
avi
d510a48742 Preserve formatting in the exported PDF
The printed book is rendered from the same markdown the editor writes, but
markdown-it escaped HTML and did not understand Folio's extensions, so
underlines, text/highlight colors, alignments, ==highlights==, callouts and
wikilinks all showed up as raw source text in the PDF. Render the print book
with a purpose-built print-format renderer that keeps every feature:
  - html: true so the toolbar's <u>, <span style=...> and <div align=...>
    pass through and render instead of appearing literally,
  - ==highlight== rendered as <mark> (new inline rule),
  - Obsidian callouts (> [!note] Title) rendered as styled divs with a bold
    title (new core rule),
  - wikilinks resolved to links via the shared wikilink plugin.
Add matching print styles for mark, underline and callout types, and e2e
assertions that none of these features leak as raw source into #printBook.
2026-08-18 10:59:28 -05:00
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