Skip to content

Commit

Permalink
modified isMatch to permit multiple links to be pasted without trigge…
Browse files Browse the repository at this point in the history
…ring embed block(WordPress#27551)
  • Loading branch information
gaavar committed Jan 3, 2021
1 parent f5eefaa commit d233aa0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/block-library/src/embed/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ const transforms = {
type: 'raw',
isMatch: ( node ) =>
node.nodeName === 'P' &&
/^\s*(https?:\/\/\S+)\s*$/i.test( node.textContent )
&& (node.textContent.toLowerCase().match(/https/g)
|| []).length
=== 1,
/^\s*(https?:\/\/\S+)\s*$/i.test( node.textContent ) &&
( node.textContent?.match( /https/gi ) ).length === 1,
transform: ( node ) => {
return createBlock( EMBED_BLOCK, {
url: node.textContent.trim(),
Expand Down

0 comments on commit d233aa0

Please sign in to comment.