oficina / mapa Public

Editor: never drop typed text when a commit cannot happen

Fable's final review of 58fd476, H1, H2 and M1 to M4, the client's half.

- H1: a page deleted under the editor no longer stops it. What is typed
  goes on autosaving as the draft (the server accepts it through
  mayDraft), the status says "Saved as a draft", nothing commits, and
  the bar's Save as a scratch page and Discard store the typing first.
  An offered draft another tab committed goes on as a new draft too.
- H2: only a reply carrying a revision is a commit. An emptied day
  ({empty: true}) starts afresh from version 0; a deleted page
  ({gone: true}) is H1's state.
- M1: Resolve stores text typed since the conflict's reply before it
  posts, and the editor refuses typing while the POST is out.
- M2: closing with a choice open, a page deleted or commits held still
  writes the unsent text as the draft, without commit=1. Show the saved
  version holds commits and flushes instead of stopping.
- M3: a close in note 38's settling window sends the loaded version
  with settling=1 instead of guessing version 0.
- M4: any reply without a conflict ends the choice on show.
- The same hunks for a newer version keep the choice and its picks.
- closing() sends prepare()'s text (the structure check), as autosave.

Gates: seven saver.test.mjs cases (H1 twice, H2, M1 to M4), each red on
the old saver; the M1 case is red with the old conflict.mjs alone.
TestL9APageDeletedMidEditKeepsWhatIsTyped and
TestL9TheInlineChoiceCommitsWhatIsOnScreen (make browser) are red on the
old bundle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 4cd3176f63d502c33ab428dbac66d57cfc55c054 parent a61155c
10 files changed, +502 −93
  • editor/conflict.mjs +11 −1
  • editor/notices.mjs +10 −5
  • editor/page.mjs +31 −6
  • editor/saver.mjs +168 −43
  • editor/saver.test.mjs +168 −9
  • editor/testkit.mjs +4 −1
  • internal/mapa/credits/assets.json +1 −1
  • internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.689d46faa609008b.js} +25 −25
  • internal/mapatest/editor_review_browser_test.go +81 −0
  • internal/mapatest/saving_review_test.go +3 −2
editor/conflict.mjs

Loading diff…

editor/notices.mjs

Loading diff…

editor/page.mjs

Loading diff…

editor/saver.mjs

Loading diff…

editor/saver.test.mjs

Loading diff…

editor/testkit.mjs

Loading diff…

internal/mapa/credits/assets.json

Loading diff…

internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.689d46faa609008b.js}

Loading diff…

internal/mapatest/editor_review_browser_test.go

Loading diff…

internal/mapatest/saving_review_test.go

Loading diff…