X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/58cadce052f5cc3c9ce2bc12f88a93cac310699a..21badde4ef7e9f907059b9f3d61859c62a5bc734:/resources/js/wysiwyg/shortcuts.js diff --git a/resources/js/wysiwyg/shortcuts.js b/resources/js/wysiwyg/shortcuts.js index 1c20df9c5..147e3c2d5 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,6 @@ export function register(editor) { editor.selection.collapse(false); editor.focus(); - }); + }, selectionText); }); }