File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed
src/components/Suggestion/LinkPicker Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change 2222import createSuggestions from '../suggestions.js'
2323import LinkPickerList from './LinkPickerList.vue'
2424
25+ import { searchProvider , getLinkWithPicker } from '@nextcloud/vue-richtext'
26+
2527export default ( ) => createSuggestions ( {
2628 listComponent : LinkPickerList ,
2729 command : ( { editor, range, props } ) => {
28- editor
29- . chain ( )
30- . focus ( )
31- . insertContentAt ( range , props . label + ' ' )
32- . run ( )
30+ getLinkWithPicker ( props . provider )
31+ . then ( link => {
32+ editor
33+ . chain ( )
34+ . focus ( )
35+ . insertContentAt ( range , link )
36+ . run ( )
37+ } )
38+ . catch ( error => {
39+ console . error ( 'Link picker promise rejected:' , error )
40+ } )
3341 } ,
3442 items : ( { query } ) => {
35- return [
36- {
37- label : 'Hello' ,
38- icon : '' ,
39- } ,
40- {
41- label : 'Hello2' ,
42- icon : '' ,
43- } ,
44- ]
43+ return searchProvider ( query )
44+ . map ( p => {
45+ return {
46+ label : p . title ,
47+ icon : p . icon_url ,
48+ provider : p ,
49+ }
50+ } )
4551 } ,
4652} )
You can’t perform that action at this time.
0 commit comments