editor.shortcuts.add('meta+shift+K', '', () => {
/** @var {EntitySelectorPopup} * */
const selectorPopup = window.$components.first('entity-selector-popup');
+ const selectionText = editor.selection.getContent({format: 'text'}).trim();
selectorPopup.show(entity => {
if (editor.selection.isCollapsed()) {
editor.insertContent(editor.dom.createHTML('a', {href: entity.link}, editor.dom.encode(entity.name)));
editor.selection.collapse(false);
editor.focus();
+ }, {
+ initialValue: selectionText,
+ searchEndpoint: '/search/entity-selector',
+ entityTypes: 'page,book,chapter,bookshelf',
+ entityPermission: 'view',
});
});
}