mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 06:01:24 +02:00
[examples] fix rich text editor active block logic (#1803)
This commit is contained in:
committed by
Ian Storm Taylor
parent
794e705c72
commit
c4c1d764d6
@@ -235,7 +235,13 @@ class RichTextExample extends React.Component {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
renderBlockButton = (type, icon) => {
|
renderBlockButton = (type, icon) => {
|
||||||
const isActive = this.hasBlock(type)
|
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 onMouseDown = event => this.onClickBlock(event, type)
|
const onMouseDown = event => this.onClickBlock(event, type)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user