Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Unexpected block validation error with unescaped ampersands. #13406

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/blocks/src/api/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,11 @@ export function createBlockWithFallback( blockNode ) {
// provided source value with the serialized output before there are any modifications to
// the block. When both match, the block is marked as valid.
if ( ! isFallbackBlock ) {
block.isValid = isValidBlockContent( blockType, block.attributes, innerHTML );
const parsedHTML = parseWithAttributeSchema( innerHTML, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will degrade performance significantly for longer posts, given the implementation of parseWithAttributeSchema.

type: 'string',
source: 'html',
} );
block.isValid = isValidBlockContent( blockType, block.attributes, parsedHTML );
}

// Preserve original content for future use in case the block is parsed as
Expand Down