1

I'm having a problem where my <br/> tags (valid JSX) get stripped to <br> upon save which makes the editor state that the block is not the same causing it to be invalid.

This means that a user cannot update the block without deleting and re-entering all the data again which is fairly tedious.

Save Text

return ( <div>
            <RichText.Content className={subheadingClass} tagName="p" value={attributes.subheading}/>
            <RichText.Content className={subsubheadingClass} tagName="p" value={attributes.subsubheading}/>
            <br/><br/>
            <RichText.Content className={paragraphClass} tagName="p" value={attributes.paragraph}/>
         </div>
);

I also have another problem with my image tags being surrounded by a <figure> tag.

Is there a way to stop the figure tag being wrapped around my images?

Save Image

<img className={carouselClass} data-image-id={image.id} src={image.url} alt {image.alt} uk-cover/>

I am stumped as to how to get past the <br> and what causes <figure> to also be incorrect. Help on either of these would be appreciated.

The WordPress version is 5.0.3.

  • You need to share the full block code for us to understand the problem and suggest solution – Ashiquzzaman Kiron Feb 12 at 10:04
0

The error which is shown by WordPress graphically is not the same output that you actually get from the block.

Open up the browser's console, and you will see the actual expected and outcome.

Do a quick diff between the two outputs and you should be able to find your mismatch.

The break tags and figure wrapping of images only occurred in the UI error and not in practice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.