File tree Expand file tree Collapse file tree 3 files changed +62
-0
lines changed
types/wordpress__block-editor Expand file tree Collapse file tree 3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export * from "./font-sizes";
1919export { default as InnerBlocks , useInnerBlocksProps } from "./inner-blocks" ;
2020export { default as InspectorAdvancedControls } from "./inspector-advanced-controls" ;
2121export { default as InspectorControls } from "./inspector-controls" ;
22+ export { default as LinkControl } from "./link-control" ;
2223export { default as MediaPlaceholder } from "./media-placeholder" ;
2324export { default as MediaUpload } from "./media-upload" ;
2425export { default as MediaUploadCheck } from "./media-upload/check" ;
Original file line number Diff line number Diff line change 1+ import { ComponentType , ReactNode } from "react" ;
2+
3+ interface WPLinkControlDefaultValue {
4+ url ?: string ;
5+ title ?: string ;
6+ opensInNewTab ?: boolean ;
7+ }
8+
9+ interface WPLinkControlSettingsValue {
10+ [ setting : string ] : any ;
11+ }
12+
13+ declare namespace LinkControl {
14+ interface Props {
15+ settings ?: Setting [ ] ;
16+ forceIsEditingLink ?: boolean ;
17+ value ?: Value ;
18+ onChange ?: ( nextValue ?: Value ) => void ;
19+ onRemove ?: ( ) => void ;
20+ onCancel ?: ( ) => void ;
21+
22+ noDirectEntry ?: boolean ;
23+ showSuggestions ?: boolean ;
24+ showInitialSuggestions ?: boolean ;
25+ withCreateSuggestion ?: boolean ;
26+ suggestionsQuery ?: any ;
27+ noURLSuggestion ?: boolean ;
28+ hasTextControl ?: boolean ;
29+ createSuggestion ?: ( ( title : string ) => Suggestion ) | undefined ;
30+ createSuggestionButtonText ?: string | ( ( searchTerm : string | undefined ) => ReactNode ) ;
31+ renderControlBottom ?: ( ) => ReactNode ;
32+ handleEntities ?: boolean ;
33+ hasRichPreviews ?: boolean ;
34+ }
35+
36+ interface Setting {
37+ id : string ;
38+ title : string ;
39+ }
40+
41+ interface Suggestion {
42+ id : string ;
43+ type : string ;
44+ title : string ;
45+ url : string ;
46+ }
47+
48+ interface Value extends WPLinkControlDefaultValue , WPLinkControlSettingsValue { }
49+ }
50+ declare const LinkControl : ComponentType < LinkControl . Props > & { DEFAULT_LINK_SETTINGS : LinkControl . Setting [ ] } ;
51+
52+ export default LinkControl ;
Original file line number Diff line number Diff line change @@ -246,6 +246,15 @@ be.withFontSizes("fontSize")(() => <h1>Hello World</h1>);
246246< be . InspectorControls group = { "styles" } > Hello World</ be . InspectorControls > ;
247247< be . InspectorControls . Slot /> ;
248248
249+ //
250+ // link-control
251+ //
252+ < be . LinkControl
253+ onChange = { item => console . log ( item ) }
254+ onRemove = { ( ) => console . log ( "removed" ) }
255+ settings = { be . LinkControl . DEFAULT_LINK_SETTINGS }
256+ /> ;
257+
249258//
250259// media-placeholder
251260//
You can’t perform that action at this time.
0 commit comments