godaddy-wordpress / godaddy-wordpress/coblocks

Pasting valid Gutenberg block markup throws a "unexpected or invalid mark-up" error

Open
#2,475 2 comments 0 reactions 0 assignees View on GitHub
[Priority] Low [Type] Bug
Dominant language
JavaScript
Stars
794
Forks
142
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug:

I should be able to paste some valid Gutenberg block-markup into the editor without it erroring.

### To reproduce:

1. Install co-blocks (can't reproduce without)
2. Open the post editor
3. Paste the following, completely valid mark-up (or insert a pattern with the same):

```

Summer
Vibe

```
5. See "This block contains unexpected or invalid content." message

The problem isn't limited to heading blocks, the same happens for paragraphs too (and probably more).

### Expected behavior:

I expected a Heading block to be inserted without any mention of unexpected errors.

### Screenshots:

![image](https://user-images.githubusercontent.com/93301/214877270-8ed356eb-ae64-4d43-bb14-f62cfbc0aa2c.png)

Console output says:
```
Block validation: Block validation failed for `core/heading` (
Object { name: "core/heading", icon: {…}, keywords: (2) […], attributes: {…}, providesContext: {}, usesContext: [], supports: {…}, styles: [], variations: [], save: heading_save_save(_ref)
, … }
).

Content generated by `save` function:

Summer
Vibe

Content retrieved from post body:

Summer
Vibe


```

I think [applyStyle](https://github.com/godaddy-wordpress/coblocks/blob/master/src/extensions/typography/apply-style.js#L14) is taking the fontFamily block attribute and putting it into the style prop, even though that's not necessary in Core.

### Isolating the problem:

- [x] This bug happens with no other plugins activated
- [x] This bug happens with a default WordPress theme active (can repro with TT3 and non-default themes)
- [x] This bug happens **without** the Gutenberg plugin active (can also repro with gutenberg trunk)
- [x] I can reproduce this bug consistently using the steps above

### WordPress version:

6.2

### Gutenberg version:

Either trunk at the time of writing, GB1.15 or whatever WP6.2 ships.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.