Repository navigation
Double-click the margin to create and edit a header or footer (#960) - #1144
Conversation
… footer
Double-clicking the top or bottom margin in Print Layout now edits the
header/footer that page shows, creating it (first page, even page or
default slot) when the page has none. insert.editHeader/editFooter take
{"page"}; insert.closeHeader takes away a created one left empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57182a0 to
3e52116
Compare
…ted edit insert.editHeader/editFooter stay pure and hand creation to the new mutating insert.createHeader/createFooter; closeHeader removes empty new ones through insert.removeEmptyHeaders. An empty new header is never saved, one an undo brings back goes on the next close, and a new header goes in the first section (linked to later ones, as in Word). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review follow-ups (a12b772):
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on Windows 11 with a letter that uses Different First Page: a logo and contact details in a borderless 3-column table in the first-page header, and a "Page N" default header on later pages. Before (0.7.0): double-clicking page 1's header put the caret in the default header, so typing never appeared on page 1. Still open (maybe out of scope here): Insert › Header › Edit Header on the ribbon still opens the default header when the cursor is on page 1, so nothing seems to happen and the typing goes into a header that isn't shown. Word opens the first-page header in that case. Headless repro on this branch, with any Different First Page document:
Happy to file the ribbon case as a separate issue if that's easier. |
# Conflicts: # ROADMAP.md
|
Thanks for the contribution, @dkhlapov! This has landed in main. If you haven't already, come join us on Discord: https://discord.gg/artcraft |
- Recovery (upstream storytold#518) now expects a crash-recovery copy to keep pictures and the parts kept verbatim, so Document::media and ::passthrough serialise again (our NamedBytes maps get Serialize and Deserialize; the source package of a document read from Word travels with them, so a recovered document still compares equal and can still be saved by keeping its file). - Upstream's new header test (storytold#1144) edits the default header from an even page, which its layout draws there. Our layout draws an even page's header from the even part only, as Word does (W3 fix 5, tested in edit_mode.rs), so the test now says an even page shows none. - inspect_save: upstream's writer now writes commentsIds.xml and commentsExtensible.xml, which the inspector reads as plain XML parts, so a regenerated save of a comment reports them. The embed's edit mode adds no comments and saves through the preserving writer; the inspector is not loosened, the three regenerating-save tests name the two parts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#960: double-click the margin to create and edit a header or footer
Closes #960. In Print Layout, double-clicking the top or bottom margin of a page now creates the header or footer that page shows, if needed, and edits it, as in Word. Different first page and odd/even pages are respected. Before, the double-click only worked when a header already existed.
What changed:
header_footer_zone).insert.editHeader/insert.editFootertake an optional{"page"}for agents. This also fixes editing the wrong header on a "Different First Page" page. An out-of-range page is an error.insert.closeHeaderremoves a newly created header or footer that is still empty, so the docx stays clean.Tests:
edit_header_on_a_page_creates_its_slot(engine: default, first-page and even-page cases, a clean round-trip, out-of-range pages).double_click_margin_creates_header_and_footer(kittest).cargo xtask cipasses.🤖 Generated with Claude Code