• Resolved Tijmen Smit

    (@tijmensmit)


    I’m playing around with creating a custom notice in Gutenberg, and based on whether the data validates when the post is saved, the notice may include some HTML links.

    I ended up only seeing the raw HTML output, so after some searching on Google I found this post on Github suggesting to use RawHTML.

    So I put this code together which does create the red notice, but it doesn’t show the actual HTML only [object Object]. So I’m clearly doing something wrong here, but not sure what? Anyone who can point me in the right direction how to make the notices show the raw HTML?

     
    wp.data.dispatch( 'core/notices' ).createNotice(
       'error',
       wp.element.createElement( wp.element.RawHTML, null, '<p>test</p>' ),
       {
          id: 'wpslupdate', // prevent duplicates
          isDismissible: true
       }
    );
    
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘HTML in createNotice shows [object Object]’ is closed to new replies.