aboutsummaryrefslogtreecommitdiff
path: root/assets/js/edit.js
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2019-01-08 23:50:48 +0100
committern-peugnet <n.peugnet@free.fr>2019-01-08 23:50:48 +0100
commit88e75286aece89a002096078e35888e9304ca273 (patch)
tree99826a719bd7fce888269c984a077d4fbd65d2ab /assets/js/edit.js
parentacdbc686630f523cee598a95415b515d531b2bde (diff)
downloadwcms-88e75286aece89a002096078e35888e9304ca273.tar.gz
wcms-88e75286aece89a002096078e35888e9304ca273.zip
fix for ctrl + s inconsistent save action
Diffstat (limited to 'assets/js/edit.js')
-rw-r--r--assets/js/edit.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/assets/js/edit.js b/assets/js/edit.js
index 6a652ad..d838017 100644
--- a/assets/js/edit.js
+++ b/assets/js/edit.js
@@ -16,7 +16,7 @@ window.onload = () => {
/**
* Manage a keyboardEvent
- * @param {KeyboardEvent} e
+ * @param {KeyboardEvent} e
*/
function keyboardHandler(e) {
if (e.composed) {
@@ -24,6 +24,8 @@ function keyboardHandler(e) {
// console.log(e.key);
switch (e.key) {
case 's':
+ e.preventDefault();
+ unsavedChanges = false;
form.submit();
return false;
}
@@ -33,7 +35,7 @@ function keyboardHandler(e) {
/**
* Manage change event
- * @param {Event} e
+ * @param {Event} e
*/
function changeHandler(e) {
unsavedChanges = true;
@@ -42,7 +44,7 @@ function changeHandler(e) {
/**
* Manage submit event
- * @param {Event} e
+ * @param {Event} e
*/
function submitHandler(e) {
unsavedChanges = false;
@@ -50,11 +52,11 @@ function submitHandler(e) {
/**
* Manage a beforeUnloadEvent
- * @param {BeforeUnloadEvent} e
+ * @param {BeforeUnloadEvent} e
*/
function confirmExit(e) {
// console.log({unsavedChanges});
if (unsavedChanges) {
- return "You have attempted to leave this page. Are you sure?";
+ return "You have unsaved changes, do you really want to leave this page?";
}
} \ No newline at end of file