From ca891a56daab7dbbe2be350551e888eedc6addc2 Mon Sep 17 00:00:00 2001 From: Salihu <91833785+salihudickson@users.noreply.github.com> Date: Wed, 8 Oct 2025 02:16:11 +0100 Subject: [PATCH] change list children to match list parent when list style changes (#10315) --- shared/editor/commands/toggleList.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/shared/editor/commands/toggleList.ts b/shared/editor/commands/toggleList.ts index 82b8295689..3f290ff71f 100644 --- a/shared/editor/commands/toggleList.ts +++ b/shared/editor/commands/toggleList.ts @@ -39,7 +39,7 @@ export default function toggleList( const currentItemType = parentList.node.content.firstChild?.type; const differentType = currentItemType && currentItemType !== itemType; - if (differentType || differentListStyle) { + if (differentType) { return chainTransactions( clearNodes(), wrapInList(listType, { listStyle }) @@ -50,10 +50,14 @@ export default function toggleList( isList(parentList.node, schema) && listType.validContent(parentList.node.content) ) { - tr.setNodeMarkup( + tr.doc.nodesBetween( parentList.pos, - listType, - listStyle ? { listStyle } : {} + parentList.pos + parentList.node.nodeSize, + (node, pos) => { + if (isList(node, schema)) { + tr.setNodeMarkup(pos, listType, listStyle ? { listStyle } : {}); + } + } ); dispatch?.(tr);