1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 06:31:28 +02:00

fix rich-text to unwrap lists with splitting, closes #3199

This commit is contained in:
Ian Storm Taylor
2019-12-02 18:19:51 -05:00
parent c06f82c5e8
commit e39f1e77ea

View File

@@ -64,8 +64,16 @@ const withRichText = editor => {
const { block: type } = command const { block: type } = command
const isActive = isBlockActive(editor, type) const isActive = isBlockActive(editor, type)
const isListType = type === 'bulleted-list' || type === 'numbered-list' const isListType = type === 'bulleted-list' || type === 'numbered-list'
Editor.unwrapNodes(editor, { match: { type: 'bulleted-list' } })
Editor.unwrapNodes(editor, { match: { type: 'numbered-list' } }) Editor.unwrapNodes(editor, {
match: { type: 'bulleted-list' },
split: true,
})
Editor.unwrapNodes(editor, {
match: { type: 'numbered-list' },
split: true,
})
const newType = isActive ? 'paragraph' : isListType ? 'list-item' : type const newType = isActive ? 'paragraph' : isListType ? 'list-item' : type
Editor.setNodes(editor, { type: newType }) Editor.setNodes(editor, { type: newType })