1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 19:57:00 +01:00

fix rich text example

This commit is contained in:
Ian Storm Taylor 2016-07-20 14:59:10 -07:00
parent bd200cf4b8
commit 8654dfc929

View File

@ -177,7 +177,19 @@ class RichText extends React.Component {
// Handle everything but list buttons.
if (type != 'bulleted-list' && type != 'numbered-list') {
const isActive = this.hasBlock(type)
transform = transform.setBlock(isActive ? DEFAULT_NODE : type)
const isList = this.hasBlock('list-item')
if (isList) {
transform = transform
.setBlock(isActive ? DEFAULT_NODE : type)
.unwrapBlock('bulleted-list')
.unwrapBlock('numbered-list')
}
else {
transform = transform
.setBlock(isActive ? DEFAULT_NODE : type)
}
}
// Handle the extra wrapping required for list buttons.