From 4840dd1ae03145b5596440024495183e6683d80d Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Fri, 26 May 2023 14:54:46 +0100 Subject: [PATCH] Simply implementation --- .../src/components/link-control/is-url-like.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/link-control/is-url-like.js b/packages/block-editor/src/components/link-control/is-url-like.js index 5edbcce432979..58861b71b837b 100644 --- a/packages/block-editor/src/components/link-control/is-url-like.js +++ b/packages/block-editor/src/components/link-control/is-url-like.js @@ -27,14 +27,10 @@ export default function isURLLike( val ) { const mayBeTLD = hasPossibleTLD( val ); const isWWW = val?.startsWith( 'www.' ); - const isHTTPProtocol = /^(http|https)/.test( val ) && protocolIsValid; - const isMailTo = val?.startsWith( 'mailto:' ) && protocolIsValid; - const isTel = val?.startsWith( 'tel:' ) && protocolIsValid; + const isInternal = val?.startsWith( '#' ) && isValidFragment( val ); - return ( - isHTTPProtocol || isWWW || isMailTo || isTel || isInternal || mayBeTLD - ); + return protocolIsValid || isWWW || isInternal || mayBeTLD; } /**