fix(superdoc): expose header/footer edits in update callbacks#2368
fix(superdoc): expose header/footer edits in update callbacks#2368luccas-harbour wants to merge 5 commits intomainfrom
Conversation
caio-pizzol
left a comment
There was a problem hiding this comment.
@luccas-harbour clean approach, event listeners are set up and cleaned up in all the right places. no correctness blockers.
left three small inline comments — one consistency fix and two simplification ideas.
on tests: the happy path is covered well. three gaps worth considering: (1) no test that events stop firing after leaving header/footer mode, (2) no test for the body-editor path through the new payload builders, (3) footer surface isn't tested end-to-end (only header).
packages/super-editor/src/core/presentation-editor/header-footer/HeaderFooterSessionManager.ts
Show resolved
Hide resolved
packages/super-editor/src/core/presentation-editor/header-footer/HeaderFooterSessionManager.ts
Outdated
Show resolved
Hide resolved
caio-pizzol
left a comment
There was a problem hiding this comment.
@luccas-harbour all three items from last round are fixed, nice. tests look good too — all the gaps are covered now.
left two small comments, nothing blocking.
| }; | ||
| }; | ||
|
|
||
| const buildEditorUpdatePayload = (payload = {}) => { |
There was a problem hiding this comment.
buildEditorUpdatePayload just passes through to buildEditorPayloadBase without adding anything — could skip the wrapper and call the base directly. worth it?
| boundingSpy.mockRestore(); | ||
| }); | ||
|
|
||
| it('re-emits live header/footer child editor updates and transactions', async () => { |
There was a problem hiding this comment.
the same ~25 lines of setup (create editor, wait for layout, mock viewport, add spies) are copied across all three new tests. a small helper would make these easier to read.
Summary
This PR makes header and footer edits observable through the same public callback surface as body edits.
Before this change, typing in header/footer child editors updated internal state, but those edits were not propagated through the public
onEditorUpdateandonTransactionhooks with the same immediacy as body edits. This caused integrations that rely on those callbacks for dirty-state tracking, autosave, and other live reactions to miss header/footer changes until blur.What Changed
updateandtransactionevents through the header/footer session flow.PresentationEditoras header/footer-specific presentation events.sourceEditorsurface(body,header, orfooter)headerIdsectionTypeTesting
PresentationEditortest that verifies live header/footer child-editor updates and transactions are re-emitted immediately.SuperDoc.vuetest that verifies header/footer presentation events are forwarded intoeditor-updateandonTransaction.