1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-10 08:26:19 +02:00

Add key short for the save file

This commit is contained in:
mikum
2016-06-08 10:39:27 +08:00
parent 933024c709
commit 26281294ab

View File

@ -176,7 +176,7 @@
e.preventDefault();
});
saveHtmlBtn.addEventListener('click', function (e) {
function save_file() {
var html = editur.cm.html.getValue();
var css = editur.cm.css.getValue();
var js = editur.cm.js.getValue();
@ -197,7 +197,18 @@
document.body.appendChild(a);
a.click();
a.remove();
}
saveHtmlBtn.addEventListener('click', function (e) {
save_file();
});
window.addEventListener('keydown',function(event) {
if ((event.ctrlKey)&&(event.keyCode==83)){
event.returnValue=false;
save_file();
}
})
window.addEventListener('click', function(e) {
if (typeof e.target.className === 'string' && e.target.className.indexOf('modal-overlay') !== -1) {