Commit graph

69 commits

Author SHA1 Message Date
avi
d249d0f00d chore(release): bump to 0.1.2 v0.1.2 2026-09-23 08:30:47 -05:00
avi
19255e07c8 feat(books): rename book titles; click-to-select recents with Rename/Delete actions 2026-09-22 20:13:50 -05:00
avi
6479656680 feat(ui): Search+Full Book nav row under Home bar; search matches chapter titles 2026-09-22 17:18:16 -05:00
avi
b453681898 refactor(ui): remove redundant sidebar Settings button (File > Settings… remains) 2026-09-22 17:02:59 -05:00
avi
18eb25b70d refactor(menu): collapse five export items into one Export submenu 2026-09-22 16:58:29 -05:00
avi
76222fc1b2 chore(release): bump to 0.1.1 v0.1.1 2026-09-19 18:49:39 -05:00
avi
f1ee73f2a1 refactor(renderer): Step 7 plain state object; fix(export): ZIP emits Markdown for native chapters 2026-09-19 18:21:48 -05:00
avi
b80aa798b2 fix(backup): exclude snapshots from recovery copy, harden change walk
Migration recovery backups no longer re-copy Folio-Backups (up to 21x bloat). bookChangedSince tracks visited dev:ino so a symlink loop in the book cannot wedge the main-process interval tick. Snapshot toggle check aligned to === false; drop dead home-shortening branch in Settings.
2026-09-19 17:20:31 -05:00
avi
542a545c0d feat: spellcheck menu, typewriter mode, file associations, updater hardening
English spellcheck suggestions with Add-to-dictionary in the native context menu plus a Settings toggle. Typewriter caret-centering mode. OS file associations for .md/.txt and Open File wording. Updater: release URL surfaced, single progress listener, two-byte tarball check, installer wait guard. Search/installer test suites registered; chapter-list layout polish; ignore KDE .directory files.
2026-09-19 16:38:17 -05:00
avi
1413e73015 feat(backup): autosave backend, continuous snapshots, and Settings modal
Background autosave toggle plus whole-book snapshots (default <book>/Folio-Backups, configurable location, retention, interval) with a one-minute change check in the main process. New Settings modal (sidebar, Ctrl+, , File menu) exposes autosave, snapshots, folder picker, and Snapshot now.
2026-09-19 16:37:56 -05:00
avi
341b89cd8a fix(renderer): chapter reorder follows selection, drag autoscrolls list
Keyboard reorder (Alt+Up/Down) restores focus and scrolls the moved row into view so repeated moves keep working. Pointer drags autoscroll near the list edges and show drop position.
2026-09-19 16:37:45 -05:00
avi
ada5eee679 feat: open Markdown files and in-app updater
Markdown:
- File > Open Markdown File... and welcome-screen 'Open .md' import
  one or more .md files as new books (named after first H1 or the
  filename; originals never modified, collision-safe folder names).
- Book dirs and .md files passed on the command line or via desktop
  file associations now open directly; single-instance lock forwards
  second launches to the running window.

Updates:
- File > Check for Updates... and welcome-screen 'Update' button:
  queries the Gitea releases API, one-click installs a newer release
  into ~/.local/share/Folio via a detached swap script that waits for
  app exit, keeps the old tree until the swap succeeds, and relaunches.
  Download is gzip-verified and restricted to the trusted release host.
  No root, no reinstall.

Tests: 19 new assertions in tests/run-update-import-test.mjs (wired
into npm test); full suite green, tsc clean.
2026-09-19 00:02:58 -05:00
avi
9aebde4c35 feat(save): autosave to DOCX by default
- add autoExportDocx() in src/main/index.ts:590 to refresh full-book and per-chapter .docx on every save
- hook saveChapterDoc, saveChapter, create/rename/delete/duplicate/restore/reorder/setColor to auto-generate DOCX in book folder
- primary autosave remains native JSON (folio-doc) for fidelity, DOCX is derived export
- fixes duplicate title in God is Decentralized chapter (remove H2 duplicate, chrome title is canonical)
2026-09-07 21:52:31 -05:00
avi
38da218e33 feat(menu): add Save As to File menu with Ctrl+Shift+S
- Add 'Save As...' item to native File menu, right under Save
- New IPC event folio:save-as-requested routes through preload to renderer
- Wired in index.ts to call saveChapterAs with current chapter ID
2026-09-05 13:37:24 -05:00
avi
04c6540e4c feat(renderer): add Save As button to chapter header
- Add 'Save As' button next to Save in the chapter writing view
- Exports current chapter as Markdown to a user-chosen file location
- New IPC handler folio:saveChapterAs shows OS save dialog
2026-09-05 12:44:07 -05:00
avi
1a1d69936c fix(renderer): normalize editor line-height to 1.0; add chapter-view export dropdown
- Set .folio-prose.ProseMirror line-height from 1.7 to 1.0 to fix
  excessive spacing between paragraphs and blockquotes
- Add PDF/DOCX/ODT export dropdown to the chapter writing view header,
  matching the Full Book view's export workflow
- Wire chapter export dropdown toggle, menu selection, and close-on-outside-click
2026-09-05 12:21:16 -05:00
avi
8e49d2769a fix(editor): left-align chapter writing surface 2026-08-31 12:42:47 -05:00
avi
40a2fb305e feat(renderer): add fluid chapter reorder motion 2026-08-31 00:57:08 -05:00
avi
a2d2d4858b refactor(renderer): split book.ts into 12 focused modules
- Extract chapter-list, editor, exports, full-book, search, toolbar, ui, welcome, comments, types
- Add shared native-doc-core.ts for document contracts
- Update main process, menu, and native-doc for new structure
- Theme and CSS updates
2026-08-29 20:16:12 -05:00
avi
b5db582538 refactor(ipc): unify 41 handlers into handleIpc wrapper; improve error logging and non-Error handling 2026-08-24 22:45:59 -05:00
avi
3afb43d4ed fix(export): unify title-injection logic across DOCX/ODT and PDF; remove drift 2026-08-24 22:10:23 -05:00
avi
4ce0a5ebfb refactor(conversion): centralize format contracts in native-doc.ts; document lossiness matrix 2026-08-24 22:00:12 -05:00
avi
90b7f2cf76 refactor(ids): co-locate ID generation and validation in ids.ts to prevent contract drift 2026-08-24 21:47:37 -05:00
avi
23cef06580 refactor(persistence): extract shared JSON I/O into json-store.ts; add parent-dir creation 2026-08-24 21:27:04 -05:00
avi
43a03272bf refactor(tests): centralize test harness boilerplate into bundle.mjs helper 2026-08-24 21:15:06 -05:00
avi
1729f7c236 Require libasound2 in deb dependencies for barebones desktop installs 2026-08-24 20:29:18 -05:00
avi
a3f366ca60 Fix migration/backup partial-failure residue, theme selector fallback, dialog promise orphaning, print table multi-block cells 2026-08-24 19:53:27 -05:00
avi
ed3f3cd84b Harden IPC handlers: error protocol on exports/imports/settings, menu null-title crash fix, recents dedupe by path, no silent permanent book delete 2026-08-24 19:49:48 -05:00
avi
c5c7c80b81 Fix data-loss and security bugs: chapter id validation, reorder merge semantics, autosave cross-write after drag, listener re-registration, delete flush, failed-load handling 2026-08-24 19:44:40 -05:00
avi
b74cfe98ab Add Neon and Meridian glass themes, bundled fonts, configurable recovery backup location, autosave and UI polish 2026-08-24 18:58:16 -05:00
avi
aaa491424d Add Undo for book and chapter deletions
- Show an Undo toast after deleting a book from Home; Undo restores the
  folder from the system trash (XDG .trashinfo, URL-decoded path match).
- Chapter delete/cut now snapshots the chapter (title, color, content,
  position) and offers Undo to restore it in place.
- Add reusable showUndoToast/hideUndoToast and #undoToast UI + styles;
  expose restoreBook/restoreChapter over the preload bridge.
- Drop the now-redundant 'cannot be undone' confirm on chapter delete and
  the inaccurate 'permanently removes' wording on book delete.
2026-08-20 18:12:33 -05:00
avi
5ac7cdb593 Fix blank editor on book open and add home delete + auto-folder new book
- Auto-select the first chapter when a book opens so the editor is no
  longer left on the placeholder (was the main `all I see is the title`
  symptom).
- Stop markdownToNative from emitting text nodes with empty content and
  defensively strip them in setEditorDoc; ProseMirror rejects such nodes,
  which made editor.commands.setContent silently empty the whole editor.
- Home screen: delete a book (sent to trash, recoverable) and create a new
  book in a folder named after it under ~/Documents.
- Add self-test coverage for new book + delete.
2026-08-20 17:35:13 -05:00
avi
80898c2e2a Add Electron Builder distribution config for Folio
- Configure AppImage (primary) + Debian .deb (secondary) into releases/.
- White Folio app icon, Office category, io.atitlan.folio appId, folio
  executable; no file associations (none invented).
- Bundle tests/selftest-scenario.js so the packaged binary can be exercised
  in place via FOLIO_SELF_TEST (inert during normal launches).
2026-08-20 15:39:37 -05:00
avi
aad1a9332a Add in-app search across chapters and switch to manual save
- Search: a 'Search' button in the sidebar footer (or Ctrl/Cmd+F) opens a
  modal that scans every chapter, lists matches grouped by chapter with
  highlighted snippets, and jumps to and scrolls the match on click. Includes
  a 'Match case' toggle.
- Manual save: remove the per-keystroke auto-save; a chapter is only persisted
  via the new Save button or Ctrl/Cmd+S. Switching chapters or closing the book
  with unsaved edits now prompts to save first.
- Extend the packaged self-test to exercise both features.
2026-08-20 15:35:28 -05:00
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