X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c6ad16dba657c82512ae495a4a38b99b8cfa9eeb..refs/pull/3598/head:/resources/js/wysiwyg/shortcuts.js diff --git a/resources/js/wysiwyg/shortcuts.js b/resources/js/wysiwyg/shortcuts.js index 7b7af41ec..8b51437f1 100644 --- a/resources/js/wysiwyg/shortcuts.js +++ b/resources/js/wysiwyg/shortcuts.js @@ -39,4 +39,19 @@ export function register(editor) { editor.formatter.apply('callout' + newFormat); }); + + // Link selector shortcut + editor.shortcuts.add('meta+shift+K', '', function() { + window.EntitySelectorPopup.show(function(entity) { + + if (editor.selection.isCollapsed()) { + editor.insertContent(editor.dom.createHTML('a', {href: entity.link}, editor.dom.encode(entity.name))); + } else { + editor.formatter.apply('link', {href: entity.link}); + } + + editor.selection.collapse(false); + editor.focus(); + }) + }); } \ No newline at end of file