Gutenberg RichText

Please paste the full code, According to official Gutenberg button block. You need to have additional block attributes to use for button link,text – https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/button/index.js <RichText.Content tagName=”a” className={ linkClass } href={ url } title={ title } style={ buttonStyle } value={ text } /> As you can see, there’s a URL, Title & Text attributes. url: … Read more

Insert shortcode in post editor from javascript (Visual / HTML)

I was pulling my hair out on this one, but I might have figured it out. Try this (with jQuery): if( ! tinyMCE.activeEditor || tinyMCE.activeEditor.isHidden()) { jQuery(‘textarea#content’).val(“[SHORTCODE]test[/SHORTCODE] “); } else { tinyMCE.execCommand(‘mceInsertRawHTML’, false, “[SHORTCODE]test[/SHORTCODE] “); } Basically, you need to set the value of the textarea directly if the editor is hidden.