Support » Developing with WordPress » Add custom text in “Block” tab Gutenberg editor: is it possible?

  • Resolved ainab

    (@ainab)


    Hi there!
    Can’t find the information so I create a new topic 🙂

    Is there a way to add custom text in the right column of the Gutenberg editor (“Block” tab) when editing posts or pages?
    What I’m exactly trying to do is adding a list of usable class names under the “Separate multiple classes with spaces.” text which is next to the “Additional CSS Class(es)” field, under the Advanced section when you select a block in the editor.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Chintesh Prajapati

    (@chinteshprajapati)

    Hi @ainab ,

    Please https://jeffreycarandang.com/extending-gutenberg-core-blocks-with-custom-attributes-and-controls/ this url

    const { InspectorAdvancedControls } = wp.editor;

    by using this component you can add text or any element under the Advanced section.

    Thanks.

    Thanks!
    Unfortunately, I don’t understand anything about node.js, npm and co, so I couln’t apply what they say in your link. But I think there is no other way, so I mark this post as resolved if other people have the same question 🙂

    Chintesh Prajapati

    (@chinteshprajapati)

    Hi @ainab ,

    I have created solution on my blog, Please visit below link

    http://cpblog.ml/additional-class-list/

    I have created one plugin over there and you have to follow some steps which are mentioned over there.

    Hope it can helps you.

    Thanks

    Hi @chinteshprajapati,
    Oh thanks, you’re so nice!

    But I have an issue: the list doesn’t appear, I have this error in the console:

    additional-classes-list.js?ver=5.3.2:77
    Uncaught TypeError: Cannot read property ‘InspectorAdvancedControls’ of undefined
    at Object.<anonymous> (additional-classes-list.js?ver=5.3.2:77)
    at __webpack_require__ (additional-classes-list.js?ver=5.3.2:20)
    at additional-classes-list.js?ver=5.3.2:63
    at additional-classes-list.js?ver=5.3.2:66

    It looks like I have an issue with wp.editor, because when I console.log(wp) I see the whole childhood, even wp.editor and wp.editor.InspectorAdvancedControls, but when I console.log(wp.editor) it logs “undefined” and I don’t know why… Do you have an idea?

    Chintesh Prajapati

    (@chinteshprajapati)

    Hi @ainab

    Go to additional-classes-list.php file

    Then append ‘wp-editor’ value in dependency parameter array which is in wp_enquesctipt…

    Thanks @chinteshprajapati!
    All’s right for me now, thank you again for your answers and your time, and have a nice day!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.