mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-31 18:50:14 +02:00
Fix
This commit is contained in:
@@ -176,38 +176,15 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
function save_file() {
|
|
||||||
var html = editur.cm.html.getValue();
|
|
||||||
var css = editur.cm.css.getValue();
|
|
||||||
var js = editur.cm.js.getValue();
|
|
||||||
|
|
||||||
var fileContent = '<html><head>\n<style>\n'
|
|
||||||
+ css + '\n</style>\n</head>\n<body>\n'
|
|
||||||
+ html + '\n<script>\n' + js + '\n</script>\n\n</body>\n</html>';
|
|
||||||
|
|
||||||
var d = new Date();
|
|
||||||
var fileName = [ 'web-maker', d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds() ].join('-');
|
|
||||||
fileName += '.html';
|
|
||||||
|
|
||||||
var a = document.createElement('a');
|
|
||||||
var blob = new Blob([ fileContent ], {type : "text/html;charset=UTF-8"});
|
|
||||||
a.href = window.URL.createObjectURL(blob);
|
|
||||||
a.download = fileName;
|
|
||||||
a.style.display = 'none';
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
};
|
|
||||||
|
|
||||||
saveHtmlBtn.addEventListener('click', function (e) {
|
saveHtmlBtn.addEventListener('click', function (e) {
|
||||||
save_file();
|
save_file();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('keydown',function(event) {
|
window.addEventListener('keydown',function(event) {
|
||||||
if ((event.ctrlKey)&&(event.keyCode==83)){
|
if ((event.ctrlKey)&&(event.keyCode==83)){
|
||||||
event.returnValue=false;
|
event.preventDefault();
|
||||||
save_file();
|
save_file();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('click', function(e) {
|
window.addEventListener('click', function(e) {
|
||||||
@@ -258,6 +235,29 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_file() {
|
||||||
|
var html = editur.cm.html.getValue();
|
||||||
|
var css = editur.cm.css.getValue();
|
||||||
|
var js = editur.cm.js.getValue();
|
||||||
|
|
||||||
|
var fileContent = '<html><head>\n<style>\n'
|
||||||
|
+ css + '\n</style>\n</head>\n<body>\n'
|
||||||
|
+ html + '\n<script>\n' + js + '\n</script>\n\n</body>\n</html>';
|
||||||
|
|
||||||
|
var d = new Date();
|
||||||
|
var fileName = [ 'web-maker', d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds() ].join('-');
|
||||||
|
fileName += '.html';
|
||||||
|
|
||||||
|
var a = document.createElement('a');
|
||||||
|
var blob = new Blob([ fileContent ], {type : "text/html;charset=UTF-8"});
|
||||||
|
a.href = window.URL.createObjectURL(blob);
|
||||||
|
a.download = fileName;
|
||||||
|
a.style.display = 'none';
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
})();
|
})();
|
Reference in New Issue
Block a user