Wiki source code of Front-End link suggest API

Last modified by Manuel Leduc on 2026/06/22 17:38

Show last authors
1 == Existing implementations ==
2
3 * XWiki ##@xwiki/platform-link-suggest-xwiki##
4 * Nextcloud ##@xwiki/cristal-link-suggest-nextcloud##
5 * File System ##@xwiki/cristal-link-suggest-filesystem##
6
7 == Enumeration ==
8
9
10 {{version since="18.0.0RC1"}}
11 === LinkType ===
12
13 Enumeration members: ##ATTACHMENT##, ##PAGE##.
14 {{/version}}
15
16 == Classes ==
17
18 {{version since="18.0.0RC1"}}
19 === ComponentInit ===
20
21 Constructor:
22 {{code language="typescript"}}new ComponentInit(container: Container): ComponentInit{{/code}}
23
24 Used to initialize the current container with the components from this package.
25 {{/version}}
26
27 == Interfaces ==
28
29 {{version since="18.0.0RC1"}}
30 === LinkSuggestService ===
31
32 {{code language="typescript"}}
33 interface LinkSuggestService {
34 getLinks(
35 query: string,
36 linkType?: LinkType,
37 mimetype?: string,
38 ): Promise<Link[]>;
39 }
40 {{/code}}
41
42 ==== getLinks ====
43
44 Returns a list of page links from a text query.
45
46 **Parameters**
47
48 * query: {{code language="typescript"}}string{{/code}} - a textual search value (e.g., PageName)
49 * Optional {{code language="typescript"}}linkType: LinkType{{/code}} - when provided, only results matching the provided type are returned
50 * Optional {{code language="typescript"}}mimetype: string{{/code}} - when provided, only results matching the provided mimetype are returned. Only used when linkType is LinkType.ATTACHMENT (e.g., "image/*" or "application/pdf")
51
52 **Returns** {{code language="typescript"}}Promise<Link[]>{{/code}}
53 {{/version}}
54
55 {{version since="18.0.0RC1"}}
56 === LinkSuggestServiceProvider ===
57
58 {{code language="typescript"}}
59 interface LinkSuggestServiceProvider {
60 get(type?: string): LinkSuggestService | undefined;
61 }
62 {{/code}}
63
64 ==== get ====
65
66 Resolve the LinkSuggestService for the current config type or for the provided type
67
68 **Parameters**
69
70 * Optional {{code language="typescript"}}type: string{{/code}} - an optional type to override the current config type
71
72 **Returns** {{code language="typescript"}}LinkSuggestService | undefined{{/code}}
73 {{/version}}
74
75 == Types ==
76
77 {{version since="18.0.0RC1"}}
78 === Link ===
79
80 {{code language="typescript"}}
81 type Link = {
82 hint: string;
83 id: string;
84 label: string;
85 reference: string;
86 type: LinkType;
87 url: string;
88 }
89 {{/code}}
90 {{/version}}
91
92 == Variables ==
93
94 {{version since="18.0.0RC1"}}
95 === name ===
96
97 The component id of LinkSuggestService.
98 {{code language="typescript"}}name: "LinkSuggestService"{{/code}}
99 {{/version}}

Get Connected