From c4c1d764d68becb5745b9c48a1c2837f48773585 Mon Sep 17 00:00:00 2001 From: David Chang Date: Tue, 1 May 2018 17:43:50 -0700 Subject: [PATCH] [examples] fix rich text editor active block logic (#1803) --- examples/rich-text/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/rich-text/index.js b/examples/rich-text/index.js index b158cab4d..4fdff7382 100644 --- a/examples/rich-text/index.js +++ b/examples/rich-text/index.js @@ -235,7 +235,13 @@ class RichTextExample extends React.Component { */ 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) return (