JavaScript for WordPress Forums Gutenberg Development Is possible to wrap a RichText in a custom component?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #48267
    pauloc
    Participant

    Hi, congratulations for this great course, I’m learning a lot.
    I’m trying to wrap several “gutenberg editor components” into a custom component so I can repeat them as a whole but it doesn’t seem to work. This is my pretty plain component (simplified):

    
        const EditorWrap = ( props ) => {
          const { attributes: {title} }= props;
          return (
            <RichText
                tagname="div"
                multiline="p"
                className="title-body"
                placeholder={__('Add your title here...')}
                value={ title }
                onChange={ title => setAttributes( {title} ) }
              />
          );
        }
    

    And I add it to my edit return function as <EditorWrap {...props} />. The component appears in the admin, but it won’t get focus, though I can’t write in it so it’s useless.
    Any help on this? Thanks in advance, Paulo.

    #48291
    Zac Gordon
    Keymaster

    Yeah, this is a really good question and I believe they are working on extending this more. I am not sure yet if it is possible but I will look into it and try to include in the next update. In the meantime please ask in the core-editor Slack channel!

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