mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 00:44:41 +08:00
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:
@ -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();
|
||||
})
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user