Skip to content

Commit

Permalink
Use existing shortcode regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Apr 28, 2020
1 parent 6860731 commit 8cf006b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
} from '@wordpress/rich-text';
import deprecated from '@wordpress/deprecated';
import { isURL } from '@wordpress/url';
import { regexp } from '@wordpress/shortcode';

/**
* Internal dependencies
Expand Down Expand Up @@ -93,9 +94,7 @@ function getAllowedFormats( {

getAllowedFormats.EMPTY_ARRAY = [];

// The given text is considered a shortcode if
// starts by the [ character and ends by the ] character.
const isShortcode = ( text ) => new RegExp( '^\\[.*\\]$' ).test( text );
const isShortcode = ( text ) => regexp( '.*' ).test( text );

function RichTextWrapper(
{
Expand Down

0 comments on commit 8cf006b

Please sign in to comment.