Skip to content

Commit

Permalink
Initial experiment PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Aug 25, 2023
1 parent 44a8678 commit 832f2e3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ export const updateAttributes = (
( ! newKind && ! isBuiltInType ) || newKind === 'custom';
const kind = isCustomLink ? 'custom' : newKind;

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

setAttributes( {
// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),
...( label && { label } ),
...( undefined !== opensInNewTab && { opensInNewTab } ),
...( id && Number.isInteger( id ) && { id } ),
...( hasId && { id } ),
...( kind && { kind } ),
...( type && type !== 'URL' && { type } ),
} );
Expand Down

0 comments on commit 832f2e3

Please sign in to comment.