From 4d693f37e356defa6dea06e9053d988835009f6f Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 7 Jan 2020 11:32:11 +0000 Subject: [PATCH 01/29] Adds ability to manual trigger search data fetch --- .../src/components/link-control/index.js | 3 ++- .../components/link-control/search-input.js | 2 ++ .../src/components/url-input/index.js | 26 ++++++++++++++----- .../block-library/src/navigation-link/edit.js | 8 ++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index e434fa33c4c74b..8c467afa7a4d2b 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -36,7 +36,7 @@ export function LinkControl( { value, settings, onChange = noop, - fetchSearchSuggestions, + manualSearch, } ) { const instanceId = useInstanceId( LinkControl ); const [ inputValue, setInputValue ] = useState( '' ); @@ -200,6 +200,7 @@ export function LinkControl( { renderSuggestions={ renderSearchResults } fetchSuggestions={ getSearchHandler } onReset={ resetInput } + manualSearch={ manualSearch } /> ) } diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js index 9360ef00801378..6d3b02ada05cd2 100644 --- a/packages/block-editor/src/components/link-control/search-input.js +++ b/packages/block-editor/src/components/link-control/search-input.js @@ -32,6 +32,7 @@ const handleLinkControlOnKeyPress = ( event ) => { const LinkControlSearchInput = ( { value, + manualSearch, onChange, onSelect, renderSuggestions, @@ -68,6 +69,7 @@ const LinkControlSearchInput = ( { __experimentalRenderSuggestions={ renderSuggestions } __experimentalFetchLinkSuggestions={ fetchSuggestions } __experimentalHandleURLSuggestions={ true } + manualSearch={ manualSearch } />