X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/58cadce052f5cc3c9ce2bc12f88a93cac310699a..refs/pull/4987/head:/resources/js/wysiwyg/shortcuts.js diff --git a/resources/js/wysiwyg/shortcuts.js b/resources/js/wysiwyg/shortcuts.js index 1c20df9c5..dbc725b1d 100644 --- a/resources/js/wysiwyg/shortcuts.js +++ b/resources/js/wysiwyg/shortcuts.js @@ -48,6 +48,7 @@ export function register(editor) { 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))); @@ -57,6 +58,11 @@ export function register(editor) { editor.selection.collapse(false); editor.focus(); + }, { + initialValue: selectionText, + searchEndpoint: '/search/entity-selector', + entityTypes: 'page,book,chapter,bookshelf', + entityPermission: 'view', }); }); }