Repository navigation
Description
Description
Pressing Shift+Tab on a nested task list item moves it into the parent bullet list as a task item, instead of starting a new task list. The editor state ends up with a task-list-item directly inside a bullet-list (the state types only allow list-item there), and the rendered list mixes a plain bullet with checkbox items. After saving, the markdown no longer round-trips: reopening it (or toggling source code mode twice) splits the list in two.
No error is thrown.
Steps to Reproduce
- Open a document with:
- a - [ ] b
- Click at the end of
band press Shift+Tab. - Type
z, press Enter, typen. - Switch to source code mode, then back to the WYSIWYG editor, then to source code mode again.
Expected Behavior
The outdented item stays a task item (checkbox and checked state preserved), and the parent list is split around it, so the item lands in a new task list at the parent level:
before Shift+Tab: bullet-list( list-item( "a", task-list( task-list-item("b") ) ) )
after Shift+Tab: bullet-list( list-item("a") ), task-list( task-list-item("b") )
This is the structure muya's parser already builds for the saved markdown (- a\n- [ ] b reopens as bullet-list(a) followed by task-list(b)), so the document stays the same across a reopen / source-mode round trip.
Cases the fix should cover:
- Items after the parent item (
- a/- [ ] b/- c): split the outer list intobullet-list(a),task-list(b),bullet-list(c). - Task items after
bin the nested list stay nested underb, as they do today. - The reverse case — a plain list item nested in a task list, outdented into the outer task list — splits the same way, into a new bullet list.
- Open question: when the block right after the split point is already a task list, merge
binto it (preferred) or keep two adjacent task lists.
Actual Behavior
- After step 3 the editor shows one
ul.mu-bullet-listholdingmu-list-item(a) and twomu-task-list-itemrows with checkboxes (bz, n). - The markdown is
- a\n- [ ] bz\n- [ ] n. - After the source-mode round trip it becomes
- a\n\n- [ ] bz\n- [ ] n:aand the task items are now two separate lists (a blank line is inserted).
Screenshots / Logs
State after Shift+Tab (from muya.editor.jsonState.getState()):
bullet-list( list-item(paragraph "a"), task-list-item(paragraph "b") )
Analysis: the UnindentType.INDENT branch of ParagraphContent._unindentListItem() (packages/muya/src/block/content/paragraphContent/index.ts) clones the task-list-item and inserts it next to the parent list-item inside the outer bullet-list, without converting the item type to match the target list. Found while reviewing #4913; the behaviour is the same on develop before and after that PR.
Reproduced in the built desktop app (Playwright + Electron) and in real Chrome against the muya e2e host.
Operating System
macOS
MarkText Version
develop @ a351c50 (the code involved is unchanged since v0.20.0-rc.2)
OS Version
macOS 27.0
Reproducibility
- I can reliably reproduce this issue
Activity
fix(muya): split the list when outdenting a task item into a plain li…
test(muya): ignore parsed ordered markers when comparing state across…
fix: keep list item kinds and footnote containers in model-backed edi…
fix: keep list item kinds and footnote containers in model-backed edi…
fix: keep list item kinds and footnote containers in model-backed edi…