Skip to content

Commit

Permalink
Close the Link UI on value updates except upon initial creation
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jan 10, 2024
1 parent 95d495b commit a4a0927
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/format-library/src/link/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function InlineLinkUI( {
}

function onChangeLink( nextValue ) {
const hasLink = linkValue?.url;
const isNewLink = ! hasLink;

// Merge the next value with the current link value.
nextValue = {
...linkValue,
Expand Down Expand Up @@ -173,7 +176,11 @@ function InlineLinkUI( {

newValue.start = newValue.end;

// Hides the Link UI.
// Hides the Link UI on change except upon the initial creation of the link.
if ( ! isNewLink ) {
newValue.activeFormats = [];
}

onChange( newValue );
}

Expand Down

0 comments on commit a4a0927

Please sign in to comment.