mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-08-06 05:43:49 +00:00
Editor shortcut for saving changes
It's Ctrl/Cmd + Enter
This commit is contained in:
parent
80e3645bb0
commit
60deff0ecd
@ -40,19 +40,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i === keys.length - 1 && i > 0 && keys[i].length === 1) {
|
||||||
|
keys[i] = keys[i].toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
switch (keys[i]) {
|
switch (keys[i]) {
|
||||||
case 'ArrowLeft': keys[i] = '←'; break;
|
case 'ArrowLeft': keys[i] = '←'; break;
|
||||||
case 'ArrowRight': keys[i] = '→'; break;
|
case 'ArrowRight': keys[i] = '→'; break;
|
||||||
case 'ArrowTop': keys[i] = '↑'; break;
|
case 'ArrowTop': keys[i] = '↑'; break;
|
||||||
case 'ArrowBottom': keys[i] = '↓'; break;
|
case 'ArrowBottom': keys[i] = '↓'; break;
|
||||||
case 'Comma': keys[i] = ','; break;
|
case 'Comma': keys[i] = ','; break;
|
||||||
}
|
case 'Enter': keys[i] = '↩'; break;
|
||||||
|
|
||||||
if (i === keys.length - 1 && i > 0) {
|
|
||||||
keys[i] = keys[i].toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (keys[i]) {
|
|
||||||
case ' ': keys[i] = 'Space'; break;
|
case ' ': keys[i] = 'Space'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,6 +330,7 @@
|
|||||||
// Hypha editor shortcuts
|
// Hypha editor shortcuts
|
||||||
if (typeof editTextarea !== 'undefined') {
|
if (typeof editTextarea !== 'undefined') {
|
||||||
let editorShortcuts = new ShortcutHandler(editTextarea);
|
let editorShortcuts = new ShortcutHandler(editTextarea);
|
||||||
|
let bindElement = bindElementFactory(editorShortcuts);
|
||||||
|
|
||||||
let shortcuts = [
|
let shortcuts = [
|
||||||
// Inspired by MS Word, Pages, Google Docs and Telegram desktop clients.
|
// Inspired by MS Word, Pages, Google Docs and Telegram desktop clients.
|
||||||
@ -362,6 +361,11 @@
|
|||||||
}
|
}
|
||||||
editorShortcuts.groupEnd();
|
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);
|
editorShortcuts.add(isMac ? 'Meta+/' : 'Ctrl+/', openShortcutsReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user