change list children to match list parent when list style changes (#10315)

This commit is contained in:
Salihu
2025-10-08 02:16:11 +01:00
committed by GitHub
parent 294d3e896a
commit ca891a56da
+8 -4
View File
@@ -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);