prevents invalid content in toggleList

This will skip the replace step for invalid content and instead inserts a new list of selected type
This commit is contained in:
Chrissi2812 2019-05-20 15:40:31 +02:00
parent 670936a160
commit a0dae562c2
No known key found for this signature in database
GPG Key ID: B4B82C7E618271DA

View File

@ -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)