mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-31 04:20:26 +02:00
Fix renderBlockButton
of rich text example (#2412)
By checking if there are blocks in the selection
This commit is contained in:
committed by
Ian Storm Taylor
parent
0c94ccebce
commit
518c7e0a51
@@ -144,9 +144,12 @@ class RichTextExample extends React.Component {
|
||||
let isActive = this.hasBlock(type)
|
||||
|
||||
if (['numbered-list', 'bulleted-list'].includes(type)) {
|
||||
const { value } = this.state
|
||||
const parent = value.document.getParent(value.blocks.first().key)
|
||||
isActive = this.hasBlock('list-item') && parent && parent.type === type
|
||||
const { value: { document, blocks } } = this.state
|
||||
|
||||
if (blocks.size > 0) {
|
||||
const parent = document.getParent(blocks.first().key)
|
||||
isActive = this.hasBlock('list-item') && parent && parent.type === type
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user