Skip to content

Commit

Permalink
Revert: allow url to be set regardless
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jan 6, 2023
1 parent 2505367 commit 51fbbaf
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,8 @@ export const updateAttributes = (

const hasId = id && Number.isInteger( id );

// If the new link value has an ID then it's an internal link so do not set the URL.
// This will be dynamically generated from the ID.
// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
const updatedUrl =
! hasId && newUrl ? encodeURI( safeDecodeURI( newUrl ) ) : '';

setAttributes( {
url: updatedUrl,
...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),
...( label && { label } ),
...( undefined !== opensInNewTab && { opensInNewTab } ),
...( hasId && { id } ),
Expand Down

0 comments on commit 51fbbaf

Please sign in to comment.