Skip to content

Commit

Permalink
Prevent content with shortcodes to be pasted inline
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Apr 24, 2020
1 parent f46c7fc commit e75e1c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/blocks/src/api/raw-handling/paste-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,19 @@ export function pasteHandler( {
}
}

if ( mode === 'INLINE' ) {
return filterInlineHTML( HTML );
}

// An array of HTML strings and block objects. The blocks replace matched
// shortcodes.
// An array of HTML strings and block objects.
// The blocks replace matched shortcodes.
const pieces = shortcodeConverter( HTML );

// The call to shortcodeConverter will always return more than one element
// if shortcodes are matched. The reason is when shortcodes are matched
// empty HTML strings are included.
const hasShortcodes = pieces.length > 1;

if ( mode === 'INLINE' && ! hasShortcodes ) {
return filterInlineHTML( HTML );
}

if (
mode === 'AUTO' &&
! hasShortcodes &&
Expand Down

0 comments on commit e75e1c3

Please sign in to comment.