1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-20 22:22:06 +03:00
Files
bookstack/resources/js/wysiwyg/utils/links.ts
Dan Brown 3e1b0587ec Lexical: Fixed undefined entity selector value
Also added pre-fill of selector search based on selected text range.
2025-12-07 15:07:08 +00:00

16 lines
598 B
TypeScript

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',
});
}