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>
10 files changed,
+502
−93
editor/conflict.mjs+11 −1editor/notices.mjs+10 −5editor/page.mjs+31 −6editor/saver.mjs+168 −43editor/saver.test.mjs+168 −9editor/testkit.mjs+4 −1internal/mapa/credits/assets.json+1 −1internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.689d46faa609008b.js}+25 −25internal/mapatest/editor_review_browser_test.go+81 −0internal/mapatest/saving_review_test.go+3 −2
editor/conflict.mjsLoading diff…
editor/notices.mjsLoading diff…
editor/page.mjsLoading diff…
editor/saver.mjsLoading diff…
editor/saver.test.mjsLoading diff…
editor/testkit.mjsLoading diff…
internal/mapa/credits/assets.jsonLoading diff…
internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.689d46faa609008b.js}Loading diff…
internal/mapatest/editor_review_browser_test.goLoading diff…
internal/mapatest/saving_review_test.goLoading diff…