From a0dae562c27776333f934621ae79591c04bbda12 Mon Sep 17 00:00:00 2001 From: Chrissi2812 Date: Mon, 20 May 2019 15:40:31 +0200 Subject: [PATCH] prevents invalid content in toggleList This will skip the replace step for invalid content and instead inserts a new list of selected type --- packages/tiptap-commands/src/commands/toggleList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tiptap-commands/src/commands/toggleList.js b/packages/tiptap-commands/src/commands/toggleList.js index df8bc1c2..8d71b73f 100644 --- a/packages/tiptap-commands/src/commands/toggleList.js +++ b/packages/tiptap-commands/src/commands/toggleList.js @@ -23,7 +23,7 @@ export default function toggleList(listType, itemType) { return liftListItem(itemType)(state, dispatch, view) } - if (isList(parentList.node, schema)) { + if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) { const { tr } = state tr.setNodeMarkup(parentList.pos, listType) if (dispatch) dispatch(tr)