Skip to content

Commit

Permalink
Rename the search field at all times
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jan 11, 2024
1 parent c2e8d29 commit 24930d4
Showing 1 changed file with 28 additions and 52 deletions.
80 changes: 28 additions & 52 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ function LinkControl( {

const showActions = isEditingLink && hasLinkValue;

const showURLInput = hasLinkValue && ! value?.id;

// Only show text control once a URL value has been committed
// and it isn't just empty whitespace.
// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.
Expand Down Expand Up @@ -401,18 +399,6 @@ function LinkControl( {
'has-actions': showActions,
} ) }
>
{ showURLInput && (
<TextControl
__nextHasNoMarginBottom
className="block-editor-link-control__field block-editor-link-control__search-input"
label={ __( 'Link' ) }
value={ currentUrlInputValue }
onChange={ setInternalURLInputValue }
onKeyDown={ handleSubmitWithEnter }
size="__unstable-large"
/>
) }

{ showTextControl && (
<TextControl
__nextHasNoMarginBottom
Expand All @@ -426,45 +412,35 @@ function LinkControl( {
/>
) }

{ ! hasLinkValue && (
<>
<LinkControlSearchInput
currentLink={ value }
className="block-editor-link-control__field block-editor-link-control__search-input"
placeholder={ searchInputPlaceholder }
value={ currentUrlInputValue }
withCreateSuggestion={
withCreateSuggestion
}
onCreateSuggestion={ createPage }
onChange={ setInternalURLInputValue }
onSelect={ handleSelectSuggestion }
showInitialSuggestions={
showInitialSuggestions
}
allowDirectEntry={ ! noDirectEntry }
showSuggestions={ showSuggestions }
suggestionsQuery={ suggestionsQuery }
withURLSuggestion={ ! noURLSuggestion }
createSuggestionButtonText={
createSuggestionButtonText
}
hideLabelFromVision={ ! showTextControl }
<LinkControlSearchInput
currentLink={ value }
className="block-editor-link-control__field block-editor-link-control__search-input"
placeholder={ searchInputPlaceholder }
value={ currentUrlInputValue }
withCreateSuggestion={ withCreateSuggestion }
onCreateSuggestion={ createPage }
onChange={ setInternalURLInputValue }
onSelect={ handleSelectSuggestion }
showInitialSuggestions={ showInitialSuggestions }
allowDirectEntry={ ! noDirectEntry }
showSuggestions={ showSuggestions }
suggestionsQuery={ suggestionsQuery }
withURLSuggestion={ ! noURLSuggestion }
createSuggestionButtonText={
createSuggestionButtonText
}
hideLabelFromVision={ ! showTextControl }
/>
{ ! showActions && (
<div className="block-editor-link-control__search-enter">
<Button
onClick={ isDisabled ? noop : handleSubmit }
label={ __( 'Submit' ) }
icon={ keyboardReturn }
className="block-editor-link-control__search-submit"
aria-disabled={ isDisabled }
/>
{ ! showActions && (
<div className="block-editor-link-control__search-enter">
<Button
onClick={
isDisabled ? noop : handleSubmit
}
label={ __( 'Submit' ) }
icon={ keyboardReturn }
className="block-editor-link-control__search-submit"
aria-disabled={ isDisabled }
/>
</div>
) }
</>
</div>
) }
</div>
{ errorMessage && (
Expand Down

0 comments on commit 24930d4

Please sign in to comment.