diff --git a/blocks/editable/index.js b/blocks/editable/index.js index a02964b7a7fc4e..d090d57410cc34 100644 --- a/blocks/editable/index.js +++ b/blocks/editable/index.js @@ -131,10 +131,18 @@ export default class Editable extends wp.element.Component { } const content = this.getContent(); + const collapsed = this.editor.selection.isCollapsed(); this.setState( { empty: ! content || ! content.length, } ); + + if ( this.props.focus.collapsed !== collapsed ) { + this.props.onFocus( { + ...this.props.focus, + collapsed, + } ); + } } onChange() { diff --git a/editor/modes/visual-editor/block.js b/editor/modes/visual-editor/block.js index 31b9f020327bb8..a89aa08bd8afc9 100644 --- a/editor/modes/visual-editor/block.js +++ b/editor/modes/visual-editor/block.js @@ -166,8 +166,9 @@ class VisualEditorBlock extends wp.element.Component { } const { isHovered, isSelected, isTyping, focus } = this.props; + const showUI = isSelected && ( ! isTyping || ! focus.collapsed ); const className = classnames( 'editor-visual-editor__block', { - 'is-selected': isSelected && ! isTyping, + 'is-selected': showUI, 'is-hovered': isHovered, } ); @@ -196,8 +197,8 @@ class VisualEditorBlock extends wp.element.Component { tabIndex="0" { ...wrapperProps } > - { ( ( isSelected && ! isTyping ) || isHovered ) && } - { isSelected && ! isTyping && + { ( showUI || isHovered ) && } + { showUI &&
{ !! settings.controls && (