File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 4
4
import { addFilter , removeFilter } from '@wordpress/hooks' ;
5
5
import { useEffect } from '@wordpress/element' ;
6
6
7
- /*
7
+ /**
8
8
* Internal dependencies
9
9
*/
10
- import { info } from '../../utils/logger ' ;
10
+ import { onAutocompleterTriggered } from '../../utils/bridge ' ;
11
11
12
12
/**
13
13
* Adds a filter for the Autocomplete completers to show an alert when @ is typed.
@@ -48,7 +48,7 @@ function addAtSymbolCompleter( completers = [] ) {
48
48
name : 'at-symbol' ,
49
49
triggerPrefix : '@' ,
50
50
options : ( ) => {
51
- info ( 'You typed an @ symbol! ' ) ;
51
+ onAutocompleterTriggered ( 'at- symbol' ) ;
52
52
// Return empty array since we're not providing actual completion options
53
53
return [ ] ;
54
54
} ,
Original file line number Diff line number Diff line change 4
4
import { addFilter , removeFilter } from '@wordpress/hooks' ;
5
5
import { useEffect } from '@wordpress/element' ;
6
6
7
- /*
7
+ /**
8
8
* Internal dependencies
9
9
*/
10
- import { info } from '../../utils/logger ' ;
10
+ import { onAutocompleterTriggered } from '../../utils/bridge ' ;
11
11
12
12
/**
13
13
* Adds a filter for the Autocomplete completers to show an alert when + is typed.
@@ -42,7 +42,7 @@ function addPlusSymbolCompleter( completers = [] ) {
42
42
name : 'plus-symbol' ,
43
43
triggerPrefix : '+' ,
44
44
options : ( ) => {
45
- info ( 'You typed a + symbol! ' ) ;
45
+ onAutocompleterTriggered ( 'plus- symbol' ) ;
46
46
// Return empty array since we're not providing actual completion options
47
47
return [ ] ;
48
48
} ,
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ export function openMediaLibrary( config ) {
121
121
}
122
122
}
123
123
124
+ /**
125
+ * Notifies the native host that an autocompleter was triggered.
126
+ *
127
+ * @param {string } type The type of autocompleter that was triggered (e.g. 'at-symbol', 'plus-symbol').
128
+ *
129
+ * @return {void }
130
+ */
131
+ export function onAutocompleterTriggered ( type ) {
132
+ dispatchToBridge ( 'onAutocompleterTriggered' , { type } ) ;
133
+ }
134
+
124
135
/**
125
136
* @typedef GBKitConfig
126
137
*
You can’t perform that action at this time.
0 commit comments