mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Add ctrl-S save shortcut
This commit is contained in:
parent
a8a7aeecd6
commit
3bbb32b25a
@ -802,10 +802,8 @@ document.addEventListener("editor", (event) => {
|
||||
Array.from(addFrontMatterItemButtons).forEach(button => {
|
||||
button.addEventListener('click', addFrontMatterItem);
|
||||
});
|
||||
|
||||
document.querySelector('form').addEventListener('submit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
let saveContent = function() {
|
||||
let data = form2js(document.querySelector('form'));
|
||||
let html = button.changeToLoading();
|
||||
let request = new XMLHttpRequest();
|
||||
@ -818,7 +816,23 @@ document.addEventListener("editor", (event) => {
|
||||
button.changeToDone((request.status != 200), html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector('form').addEventListener('submit', (event) => {
|
||||
event.preventDefault();
|
||||
saveContent();
|
||||
});
|
||||
|
||||
window.addEventListener('keydown', (event) => {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
switch (String.fromCharCode(event.which).toLowerCase()) {
|
||||
case 's':
|
||||
event.preventDefault();
|
||||
saveContent();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user