]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/shortcuts.js
Added 'Sort Book' action to chapters
[bookstack] / resources / js / wysiwyg / shortcuts.js
index 7b7af41ec6db874b3f92b9c7887867275240560a..8b51437f1d811959afba20ed9b766b4c98b44c5e 100644 (file)
@@ -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