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:
@@ -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 })
|
||||||
|
Reference in New Issue
Block a user