refactor of keydown event (for future enhancements and features)
This commit is contained in:
parent
ec515f6a06
commit
d00d0e7149
30
dist/mailgo.js
vendored
30
dist/mailgo.js
vendored
@ -155,25 +155,11 @@ mailgoInit = () => {
|
||||
// add the modal at the end of the body
|
||||
document.body.appendChild(modal);
|
||||
|
||||
// allow the escape key to hide the modal
|
||||
mailgo.addEventListener(
|
||||
"keydown",
|
||||
event => {
|
||||
if (event.keyCode === 27) {
|
||||
hideMailgo();
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
// add the event mailgoKeydown on mailgo
|
||||
mailgo.addEventListener("keydown", mailgoKeydown, false);
|
||||
|
||||
// every click outside the modal will hide the modal
|
||||
modalBackground.addEventListener(
|
||||
"click",
|
||||
event => {
|
||||
hideMailgo();
|
||||
},
|
||||
false
|
||||
);
|
||||
modalBackground.addEventListener("click", hideMailgo, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -328,6 +314,16 @@ mailgoCheckRender = event => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* mailgoKeydown
|
||||
* function to manage the keydown event when the modal is showing
|
||||
*/
|
||||
mailgoKeydown = event => {
|
||||
if (event.keyCode === 27) {
|
||||
hideMailgo();
|
||||
}
|
||||
};
|
||||
|
||||
// DOMContentLoaded -> mailgoInit (creates the modal)
|
||||
document.addEventListener("DOMContentLoaded", mailgoInit, false);
|
||||
|
||||
|
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -155,25 +155,11 @@ mailgoInit = () => {
|
||||
// add the modal at the end of the body
|
||||
document.body.appendChild(modal);
|
||||
|
||||
// allow the escape key to hide the modal
|
||||
mailgo.addEventListener(
|
||||
"keydown",
|
||||
event => {
|
||||
if (event.keyCode === 27) {
|
||||
hideMailgo();
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
// add the event mailgoKeydown on mailgo
|
||||
mailgo.addEventListener("keydown", mailgoKeydown, false);
|
||||
|
||||
// every click outside the modal will hide the modal
|
||||
modalBackground.addEventListener(
|
||||
"click",
|
||||
event => {
|
||||
hideMailgo();
|
||||
},
|
||||
false
|
||||
);
|
||||
modalBackground.addEventListener("click", hideMailgo, false);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -328,6 +314,16 @@ mailgoCheckRender = event => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* mailgoKeydown
|
||||
* function to manage the keydown event when the modal is showing
|
||||
*/
|
||||
mailgoKeydown = event => {
|
||||
if (event.keyCode === 27) {
|
||||
hideMailgo();
|
||||
}
|
||||
};
|
||||
|
||||
// DOMContentLoaded -> mailgoInit (creates the modal)
|
||||
document.addEventListener("DOMContentLoaded", mailgoInit, false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user