Added ctrl+shift+k shortcut to WYSIWYG

Shows entity select dialog for more direct entity link insertion.
Aligns with shortcut from markdown editor.

For #3244
This commit is contained in:
Dan Brown
2022-02-28 13:29:34 +00:00
parent 1253711c7d
commit 20ecaa5c5a
3 changed files with 25 additions and 0 deletions

View 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();
})
});
}