Skip to content
Merged
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
4 changes: 3 additions & 1 deletion blocks/api/raw-handling/normalise-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export default function( HTML ) {
accu.appendChild( node );
}
} else if ( isInline( node ) ) {
accu.appendChild( document.createElement( 'P' ) );
if ( ! accu.lastChild || accu.lastChild.nodeName !== 'P' ) {
accu.appendChild( document.createElement( 'P' ) );
}
accu.lastChild.appendChild( node );
} else {
accu.appendChild( node );
Expand Down
4 changes: 4 additions & 0 deletions blocks/api/raw-handling/test/normalise-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ describe( 'normaliseBlocks', () => {
equal( normaliseBlocks( '<a href="#">test</a>' ), '<p><a href="#">test</a></p>' );
} );

it( 'should not break between inline siblings', () => {
equal( normaliseBlocks( '<strong>test</strong>&nbsp;is a test of&nbsp;<a href="#">test</a>&nbsp;using a&nbsp;<a href="#">test</a>.' ), '<p><strong>test</strong>&nbsp;is a test of&nbsp;<a href="#">test</a>&nbsp;using a&nbsp;<a href="#">test</a>.</p>' );
} );

it( 'should not append empty text nodes', () => {
equal( normaliseBlocks( '<p>test</p>\n' ), '<p>test</p>' );
} );
Expand Down
5 changes: 4 additions & 1 deletion blocks/library/shortcode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ registerBlockType( 'core/shortcode', {
// letters, but numbers and underscores should work fine too.
// Be wary of using hyphens (dashes), you'll be better off not
// using them." in https://codex.wordpress.org/Shortcode_API
tag: '[a-z0-9_-]+',
// Require that the first character be a letter. This notably
// prevents footnote markings ([1]) from being caught as
// shortcodes.
tag: '[a-z][a-z0-9_-]*',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This whole line looks a bit add to me... maybe I missed some conversation. There is now a fallback block block for unhandled shortcodes? What if they are inline shortcodes? I'll maybe open a new ticket, sorry. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct, see #3610.

Inline shortcodes are definitely a problem. I’d be grateful if you could weigh in on #3806 (comment) !

attributes: {
text: {
type: 'string',
Expand Down