]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/utils/links.ts
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / resources / js / wysiwyg / utils / links.ts
1 import {EntitySelectorPopup} from "../../components";
2
3 type EditorEntityData = {
4     link: string;
5     name: string;
6 };
7
8 export function showLinkSelector(callback: (entity: EditorEntityData) => any, selectionText?: string) {
9     const selector: EntitySelectorPopup = window.$components.first('entity-selector-popup') as EntitySelectorPopup;
10     selector.show((entity: EditorEntityData) => callback(entity), {
11         initialValue: selectionText,
12         searchEndpoint: '/search/entity-selector',
13         entityTypes: 'page,book,chapter,bookshelf',
14         entityPermission: 'view',
15     });
16 }