Skip to content

Commit 9f0acdc

Browse files
committed
Rename the search field at all times
1 parent 0dab64d commit 9f0acdc

File tree

1 file changed

+28
-52
lines changed

1 file changed

+28
-52
lines changed

packages/block-editor/src/components/link-control/index.js

+28-52
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ function LinkControl( {
334334

335335
const showActions = isEditingLink && hasLinkValue;
336336

337-
const showURLInput = hasLinkValue && ! value?.id;
338-
339337
// Only show text control once a URL value has been committed
340338
// and it isn't just empty whitespace.
341339
// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.
@@ -401,18 +399,6 @@ function LinkControl( {
401399
'has-actions': showActions,
402400
} ) }
403401
>
404-
{ showURLInput && (
405-
<TextControl
406-
__nextHasNoMarginBottom
407-
className="block-editor-link-control__field block-editor-link-control__search-input"
408-
label={ __( 'Link' ) }
409-
value={ currentUrlInputValue }
410-
onChange={ setInternalURLInputValue }
411-
onKeyDown={ handleSubmitWithEnter }
412-
size="__unstable-large"
413-
/>
414-
) }
415-
416402
{ showTextControl && (
417403
<TextControl
418404
__nextHasNoMarginBottom
@@ -426,45 +412,35 @@ function LinkControl( {
426412
/>
427413
) }
428414

429-
{ ! hasLinkValue && (
430-
<>
431-
<LinkControlSearchInput
432-
currentLink={ value }
433-
className="block-editor-link-control__field block-editor-link-control__search-input"
434-
placeholder={ searchInputPlaceholder }
435-
value={ currentUrlInputValue }
436-
withCreateSuggestion={
437-
withCreateSuggestion
438-
}
439-
onCreateSuggestion={ createPage }
440-
onChange={ setInternalURLInputValue }
441-
onSelect={ handleSelectSuggestion }
442-
showInitialSuggestions={
443-
showInitialSuggestions
444-
}
445-
allowDirectEntry={ ! noDirectEntry }
446-
showSuggestions={ showSuggestions }
447-
suggestionsQuery={ suggestionsQuery }
448-
withURLSuggestion={ ! noURLSuggestion }
449-
createSuggestionButtonText={
450-
createSuggestionButtonText
451-
}
452-
hideLabelFromVision={ ! showTextControl }
415+
<LinkControlSearchInput
416+
currentLink={ value }
417+
className="block-editor-link-control__field block-editor-link-control__search-input"
418+
placeholder={ searchInputPlaceholder }
419+
value={ currentUrlInputValue }
420+
withCreateSuggestion={ withCreateSuggestion }
421+
onCreateSuggestion={ createPage }
422+
onChange={ setInternalURLInputValue }
423+
onSelect={ handleSelectSuggestion }
424+
showInitialSuggestions={ showInitialSuggestions }
425+
allowDirectEntry={ ! noDirectEntry }
426+
showSuggestions={ showSuggestions }
427+
suggestionsQuery={ suggestionsQuery }
428+
withURLSuggestion={ ! noURLSuggestion }
429+
createSuggestionButtonText={
430+
createSuggestionButtonText
431+
}
432+
hideLabelFromVision={ ! showTextControl }
433+
/>
434+
{ ! showActions && (
435+
<div className="block-editor-link-control__search-enter">
436+
<Button
437+
onClick={ isDisabled ? noop : handleSubmit }
438+
label={ __( 'Submit' ) }
439+
icon={ keyboardReturn }
440+
className="block-editor-link-control__search-submit"
441+
aria-disabled={ isDisabled }
453442
/>
454-
{ ! showActions && (
455-
<div className="block-editor-link-control__search-enter">
456-
<Button
457-
onClick={
458-
isDisabled ? noop : handleSubmit
459-
}
460-
label={ __( 'Submit' ) }
461-
icon={ keyboardReturn }
462-
className="block-editor-link-control__search-submit"
463-
aria-disabled={ isDisabled }
464-
/>
465-
</div>
466-
) }
467-
</>
443+
</div>
468444
) }
469445
</div>
470446
{ errorMessage && (

0 commit comments

Comments
 (0)