Skip to content

Commit a992f46

Browse files
Disabled initial suggestions
1 parent f4b8aab commit a992f46

File tree

1 file changed

+1
-45
lines changed
  • packages/block-library/src/button

1 file changed

+1
-45
lines changed

packages/block-library/src/button/edit.js

+1-45
Original file line numberDiff line numberDiff line change
@@ -59,44 +59,6 @@ import {
5959
import { useMergeRefs, useRefEffect } from '@wordpress/compose';
6060
import { useSelect, useDispatch } from '@wordpress/data';
6161

62-
/**
63-
* Given the Link block's type attribute, return the query params to give to
64-
* /wp/v2/search.
65-
*
66-
* @param {string} type Link block's type attribute.
67-
* @param {string} kind Link block's entity of kind (post-type|taxonomy)
68-
* @return {{ type?: string, subtype?: string }} Search query params.
69-
*/
70-
function getSuggestionsQuery( type, kind ) {
71-
switch ( type ) {
72-
case 'post':
73-
case 'page':
74-
return { type: 'post', subtype: type };
75-
case 'category':
76-
return { type: 'term', subtype: 'category' };
77-
case 'tag':
78-
return { type: 'term', subtype: 'post_tag' };
79-
case 'post_format':
80-
return { type: 'post-format' };
81-
default:
82-
if ( kind === 'taxonomy' ) {
83-
return { type: 'term', subtype: type };
84-
}
85-
if ( kind === 'post-type' ) {
86-
return { type: 'post', subtype: type };
87-
}
88-
return {
89-
// for custom link which has no type
90-
// always show pages as initial suggestions
91-
initialSuggestionsSearchOptions: {
92-
type: 'post',
93-
subtype: 'page',
94-
perPage: 20,
95-
},
96-
};
97-
}
98-
}
99-
10062
const LINK_SETTINGS = [
10163
...LinkControl.DEFAULT_LINK_SETTINGS,
10264
{
@@ -273,8 +235,7 @@ function ButtonEdit( props ) {
273235
return {};
274236
}
275237

276-
const { getSettings } = select( blockEditorStore );
277-
const _settings = getSettings();
238+
const _settings = select( blockEditorStore ).getSettings();
278239

279240
const blockBindingsSource = getBlockBindingsSource(
280241
metadata?.bindings?.url?.source
@@ -484,11 +445,6 @@ function ButtonEdit( props ) {
484445
}
485446
withCreateSuggestion={ userCanCreatePages }
486447
createSuggestionButtonText={ createButtonText }
487-
showInitialSuggestions
488-
suggestionsQuery={ getSuggestionsQuery(
489-
'page',
490-
'post-type'
491-
) }
492448
/>
493449
</Popover>
494450
) }

0 commit comments

Comments
 (0)