Skip to content

Notes: speaker notes show their formatting and keep it when edited - #168

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
Mathiasko:fix/notes-rich-text
Oct 14, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
Mathiasko:fix/notes-rich-text

Conversation

@Mathiasko

Copy link
Copy Markdown
Contributor

Speaker notes with formatting (a bold first line, indented points with bullets) showed as plain lines in the notes pane and in Notes Page. Editing them there also dropped all of that formatting from the notes, and from the saved .pptx.

Cause: import and export were fine (read_notes keeps the full text body, notes_xml writes it back). The UI was the problem: both editors were a plain egui::TextEdit over Slide::notes_text() (status.rs, sorter.rs), and on blur they saved through slide.notes {text}, which did TextBody::from_text and wiped every bold run, level, indent and bullet of the slide's notes.

What changed:

  • ui-egui: new notes.rs, one notes editor shared by the notes pane and Notes Page.
    • Draws bold, italic, underline, strikethrough and size from the runs, and each paragraph's margin, hanging indent and bullet or number. Symbol-font bullets (Wingdings § etc.) are mapped the same way as on slides.
    • Lays out paragraph by paragraph, so wrapped lines align with the text, not the bullet.
    • Each edit is applied to a formatted draft, so typed text takes the formatting where it lands (Enter in a bulleted point starts another). The draft is saved when the field loses focus or the slide changes. This also fixes an older case where an edit could be dropped if the field lost focus between frames.
  • engine: slide.notes takes body (formatted notes), and slide.inspect returns notesBody. slide.notes {text} now changes only the retyped text (new deckcraft_model::edit::replace_text); text that shares nothing with the old notes still comes in as plain text.
  • text: map_symbol_bullet is public for the notes editor.
  • docs: docs/file-format-parity.md notes row, status line and revision history.

Tests:

  • model replace_text_keeps_formatting: typing into a bold heading, Enter after a bullet, deleting paragraphs, fully new text.
  • pptx tests/notes.rs (2): a generated notes slide with a bold heading, a plain line, level-2 points with a Wingdings bullet and hanging indent, a bold label followed by plain text, an italic run, buNone and a closing plain line. Checks import, round trip and the written XML. These two also pass on main (import and export were never broken); they guard it.
  • engine editing_notes_keeps_their_formatting_through_pptx: open .pptx, edit through slide.notes, save, reopen; also covers notesBody and rejects an invalid body. The text-edit part fails on main.
  • ui-egui notes::tests::*: bullets and numbering, laid-out bold and indents, wrapped lines start at the margin, typing keeps formatting, extreme sizes and NaN indents are safe.
  • ui-egui editing_notes_in_the_pane_keeps_their_formatting (egui_kittest): types into the bold heading, presses Enter in a bulleted point and types, leaves the field, saves .pptx and reopens.

Verified on macOS arm64:

  • CRAFT_FONTS_DIR=<craft-fonts at ci.yml's CRAFT_FONTS_REF> cargo xtask ci passes (fmt, clippy -D warnings, cargo test --workspace, assets, layers, wasm check). It ran on this change before rebasing onto ci: refactor workflows to use storytold/craft-common-actions #152, which only touches workflows.
  • In the app (control channel + screenshots) with generated Slovak-style decks: bold heading, plain second line, ▪ bullets with hanging indent, a wrapped point whose second line sits under the text, a bold label followed by plain text, underline and italic, unindented closing lines, diacritics intact. Notes Page looks the same. Saving from the app keeps b="1", lvl, marL and the Wingdings font.

Not in this PR:

  • PDF notes pages still print the notes as plain text.
  • Bullets or indents defined only in a custom notes master are not shown (the reader doesn't keep that style); levels without their own margin get 36 pt per level.
  • Paragraph alignment and text colour are ignored in the pane; no bold/italic shortcuts in it.
  • If one slide.notes {text} call changes text in several separate places, the formatting between them can still be lost; sending body avoids that.

🤖 Generated with Claude Code

Notes from a .pptx were read and written with their formatting, but the notes pane and Notes
Page drew them as plain text (Slide::notes_text in a plain TextEdit), and any edit there saved
the text back through slide.notes as TextBody::from_text, dropping every bold run, level,
indent and bullet of the slide's notes.

- ui-egui: a notes editor (notes.rs) shared by the notes pane and Notes Page. It draws bold,
  italic, underline, strikethrough and size from the runs, and each paragraph's margin, hanging
  indent and bullet or number (Wingdings/Symbol bullets mapped as on slides); paragraphs are
  laid out one by one so wrapped lines align with the text, not the bullet. Each edit is applied
  to a formatted draft, so typed text takes the formatting where it lands (Enter in a bulleted
  point starts another), and the draft is saved once the field loses focus or the slide changes.
- engine: slide.notes takes `body` (formatted notes, as slide.inspect's new `notesBody`), and
  `text` now changes only what was retyped (model edit::replace_text); text sharing nothing
  with the old notes is still plain.
- text: map_symbol_bullet is public for the notes editor.

PDF notes pages still print the notes as plain text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for this contribution, @Mathiasko! It has landed on main and will ship in the next DeckCraft release.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants