Repository navigation
fix(muya): edit a footnote definition as its own container (#5340, #5343) - #5347
Merged
Merged
Conversation
Backspace at the start of a top-level footnote definition handled the paragraph as a plain paragraph: it merged `note` into the previous block and left an empty `[^1]: ` definition behind, and did nothing when the footnote was the first block of the document. Treat it like Backspace at the start of a block-quote: the footnote is replaced by the blocks it held and the caret stays at the start of the first one. Backspace at the start of a later paragraph still merges it into the previous paragraph inside the footnote. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
…tainer (#5340) `_paragraphParentType` walked up to the nearest block-quote or list-item ancestor, but the block-quote and list handlers edit the paragraph's grandparent as that container. For a footnote definition inside a list item (`list-item > footnote > paragraph`), Backspace at the start of the note appended a block into the list item's first paragraph and the next state flush threw "Cannot use numerical key for object container"; Enter nested a list item inside the list item. Inside a quote only the first paragraph of the footnote was moved out. Resolve the handling from the container that holds the paragraph, with the footnote as a container of its own, so a footnote anywhere is edited like a top-level one. Paragraphs directly in a list item or quote are handled as before; the footnote is the only block that can sit between a paragraph and those containers. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
This was referenced Sep 14, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5340
Closes #5343
Summary
A footnote definition is now edited as a container of its own, wherever it sits.
1.
fix(muya): remove a footnote wrapper on Backspace at its start (#5343)Backspace at the start of a top-level footnote handled the paragraph as a plain paragraph: it merged
noteinto the previous block and left an empty[^1]:behind, or did nothing when the footnote was the first block. It now behaves like Backspace at the start of a block-quote: the footnote is replaced by the blocks it held, and the caret stays at the start of the first one. Backspace at the start of a later paragraph still merges it into the previous paragraph inside the footnote.2.
fix(muya): pick Backspace/Enter handling from the paragraph's own container (#5340)ParagraphContent._paragraphParentType()walked up to the nearestblock-quote/list-item/task-list-itemancestor, while those handlers edit the paragraph's grandparent as that container. Forlist-item > footnote > paragraph:noteappended a block into the list item's first paragraph, and the next state flush threwCannot use numerical key for object container.list-iteminside the list item.The handling is now resolved from the container that holds the paragraph (
this.parent.parent), withfootnoteas a recognised container. For paragraphs directly in a list item or quote nothing changes. The footnote is the only registered block that can sit between a paragraph and those containers (paragraphs are held by the scroll page,block-quote,list-item,task-list-itemandfootnote).Behaviour in real Chrome (muya e2e host, real keys, caret at the start of
note/more)x+[^1]: notexnote+ empty[^1]:x,note[^1]: note(first block)notex+[^1]: note/morexnote+[^1]: morex,note,morex+[^1]: note/more(atmore)[^1]: notemore[^1]: notemore(unchanged)> a+> [^1]: notea,note)a,note) (unchanged)> a+> [^1]: note/morea,note,[^1]: more)a,note,more)- a+[^1]: note- a/note- [ ] a+[^1]: note- [ ] a/notex+[^1]: notenotein the footnote- a+[^1]: note[^1]:+ nested- notenotein the footnoteIn every case above on this branch: no renderer error, typing afterwards works, undo restores the loaded document, and reopening the saved markdown gives the same state (except Enter, where an empty first paragraph in a footnote can't be written as markdown — same as top-level footnotes on develop).
Type of change
Test plan
paragraphContent/__tests__/footnoteContainer.spec.ts(happy-dom, flushes the JSON state synchronously so a malformed op throws inside the test):Cannot use numerical key for object container), in a task list item (same), two-paragraph footnote in a quote, Enter in a list-item footnote (fails on develop: nested list item).- a+> q,> - a, nested lists; Backspace and Enter), recorded from develop.vitest run226 files / 1588 tests pass;lint(no new warnings),lint:types,check-circularpass.footnote,footnote-scenarios,lists,list-nav-4644,list-paste-outdent-4899,blockquote-and-rulepass;cross-block-enterfails locally on develop as well.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn