Support » Plugin: Gutenberg » Displaying Inline Toolbar

  • Resolved itsdavidmorgan

    (@itsdavidmorgan)


    Hey Guys,

    I’m building a custom block, and I’m having trouble getting the inline toolbar to display when focusing on a RichText field. This seemed to work before one of the more recent Gutenberg updates.

    With my current code, the inline toolbar is displaying, but it’s always displayed, even before focusing on the field. I would like the toolbar to display only when the field has been focused on.

    I’m coding in ES5:

    el( blocks.RichText, {
    	tagName: 'p',
    	placeholder: i18n.__( 'Write your content...' ),
    	style: { color: attributes.textColor },
    	value: attributes.content,
    	onChange: function( newContent ) {
    		props.setAttributes( { content: newContent } );
    	},
    	focus: focus,
    	onFocus: props.setFocus,
    	isSelected: props.isSelected,
    	inlineToolbar: true,
    } ),

    I’m still getting familiar with coding in ES5, so any help would be appreciated.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Riad Benguella

    (@youknowriad)

    Hi David!

    The focus and setFocus prop have been removed from the API some releases ago. Try removing those. The toolbar should show up when the isSelected prop is true (it should match the isSelected prop of the block in general).

    Try these, if it doesn’t work please share the whole èdit function of your block.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Inline Toolbar’ is closed to new replies.