+
{ suggestions.map( ( suggestion, index ) => {
- if ( shouldShowCreateEntity && CREATE_TYPE === suggestion.type ) {
+ if (
+ shouldShowCreateEntity &&
+ CREATE_TYPE === suggestion.type
+ ) {
return (
{
- handleOnCreate(suggestion.title);
- } }
+ handleOnCreate( suggestion.title );
+ } }
key={ `${ suggestion.id }-${ suggestion.type }` }
- itemProps={ buildSuggestionItemProps( suggestion, index ) }
+ itemProps={ buildSuggestionItemProps(
+ suggestion,
+ index
+ ) }
isSelected={ index === selectedSuggestion }
/>
);
@@ -351,39 +388,32 @@ function LinkControl( {
}
return (
- { ...suggestionsListProps }
- className={ resultsListClasses }
- aria-labelledby={ searchResultsLabelId }
- >
- { suggestions.map( ( suggestion, index ) => (
{
stopEditing();
onChange( { ...value, ...suggestion } );
} }
isSelected={ index === selectedSuggestion }
- isURL={ manualLinkEntryTypes.includes(
- suggestion.type.toLowerCase()
- ) }
+ isURL={ directLinkEntryTypes.includes(
+ suggestion.type.toLowerCase()
+ ) }
searchTerm={ inputValue }
/>
);
} ) }
-
);
};
return (
{
stopEditing();
- if (suggestion.type && CREATE_TYPE === suggestion.type) {
- handleOnCreate(inputValue);
+ if (
+ suggestion.type &&
+ CREATE_TYPE === suggestion.type
+ ) {
+ handleOnCreate( inputValue );
} else {
-
handleSelectSuggestion( suggestion, value )();
}
} }
@@ -414,14 +446,13 @@ function LinkControl( {
showInitialSuggestions={ showInitialSuggestions }
errorMsg={ errorMsg }
/>
- ) }
-
) : (
- :
+
- className="screen-reader-text"
-
- >
+
{ __( 'Currently selected' ) }:
@@ -463,7 +494,7 @@ function LinkControl( {
onChange={ onChange }
/>
- }
+ ) }
);
}