mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Lexical: Connected link selector to link form
This commit is contained in:
16
resources/js/wysiwyg/utils/links.ts
Normal file
16
resources/js/wysiwyg/utils/links.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {EntitySelectorPopup} from "../../components";
|
||||
|
||||
type EditorEntityData = {
|
||||
link: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export function showLinkSelector(callback: (entity: EditorEntityData) => any, selectionText?: string) {
|
||||
const selector: EntitySelectorPopup = window.$components.first('entity-selector-popup') as EntitySelectorPopup;
|
||||
selector.show((entity: EditorEntityData) => callback(entity), {
|
||||
initialValue: selectionText,
|
||||
searchEndpoint: '/search/entity-selector',
|
||||
entityTypes: 'page,book,chapter,bookshelf',
|
||||
entityPermission: 'view',
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user