Front-End link suggest API
Last modified by Manuel Leduc on 2026/06/22 17:38
Content
Reference
Existing implementations
- XWiki @xwiki/platform-link-suggest-xwiki
- Nextcloud @xwiki/cristal-link-suggest-nextcloud
- File System @xwiki/cristal-link-suggest-filesystem
Enumeration
XWiki 18.0.0+
LinkType
Enumeration members: ATTACHMENT, PAGE.
Classes
XWiki 18.0.0+
ComponentInit
Constructor:new ComponentInit(container: Container): ComponentInit
Used to initialize the current container with the components from this package.
Interfaces
XWiki 18.0.0+
LinkSuggestService
interface LinkSuggestService {
getLinks(
query: string,
linkType?: LinkType,
mimetype?: string,
): Promise<Link[]>;
}getLinks
Returns a list of page links from a text query.
Parameters
- query:
string- a textual search value (e.g., PageName) - Optional
linkType: LinkType- when provided, only results matching the provided type are returned - Optional
mimetype: string- when provided, only results matching the provided mimetype are returned. Only used when linkType is LinkType.ATTACHMENT (e.g., "image/*" or "application/pdf")
Returns Promise<Link[]>
XWiki 18.0.0+
LinkSuggestServiceProvider
interface LinkSuggestServiceProvider {
get(type?: string): LinkSuggestService | undefined;
}get
Resolve the LinkSuggestService for the current config type or for the provided type
Parameters
- Optional
type: string- an optional type to override the current config type
Returns LinkSuggestService | undefined
Types
XWiki 18.0.0+
Link
type Link = {
hint: string;
id: string;
label: string;
reference: string;
type: LinkType;
url: string;
}Variables
XWiki 18.0.0+
name
The component id of LinkSuggestService.name: "LinkSuggestService"