1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-21 15:56:50 +00:00

Editor shortcut for saving changes

It's Ctrl/Cmd + Enter
This commit is contained in:
handlerug 2021-06-13 23:28:02 +07:00
parent 80e3645bb0
commit 60deff0ecd
No known key found for this signature in database
GPG Key ID: 38009F0605051491

View File

@ -40,19 +40,17 @@
}
}
if (i === keys.length - 1 && i > 0 && keys[i].length === 1) {
keys[i] = keys[i].toUpperCase();
}
switch (keys[i]) {
case 'ArrowLeft': keys[i] = '←'; break;
case 'ArrowRight': keys[i] = '→'; break;
case 'ArrowTop': keys[i] = '↑'; break;
case 'ArrowBottom': keys[i] = '↓'; break;
case 'Comma': keys[i] = ','; break;
}
if (i === keys.length - 1 && i > 0) {
keys[i] = keys[i].toUpperCase();
}
switch (keys[i]) {
case 'Enter': keys[i] = '↩'; break;
case ' ': keys[i] = 'Space'; break;
}
@ -332,6 +330,7 @@
// Hypha editor shortcuts
if (typeof editTextarea !== 'undefined') {
let editorShortcuts = new ShortcutHandler(editTextarea);
let bindElement = bindElementFactory(editorShortcuts);
let shortcuts = [
// Inspired by MS Word, Pages, Google Docs and Telegram desktop clients.
@ -362,6 +361,11 @@
}
editorShortcuts.groupEnd();
editorShortcuts.groupStart();
bindElement(isMac ? 'Meta+Enter' : 'Ctrl+Enter', $('.edit-form__save'), 'Save changes');
editorShortcuts.groupEnd();
// Help shortcut
editorShortcuts.add(isMac ? 'Meta+/' : 'Ctrl+/', openShortcutsReference);
}