mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 05:06:04 +00:00
Update editor.html
This commit is contained in:
parent
be782c1ebd
commit
4105b567ee
|
@ -61,6 +61,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var editor;
|
var editor;
|
||||||
|
var currentFileName = "sayhello.js";
|
||||||
|
|
||||||
function resizeEditor() {
|
function resizeEditor() {
|
||||||
if (editor) {
|
if (editor) {
|
||||||
var ribbonHeight = document.querySelector('nav').offsetHeight;
|
var ribbonHeight = document.querySelector('nav').offsetHeight;
|
||||||
|
@ -108,6 +110,8 @@
|
||||||
function handleFileSelect(event) {
|
function handleFileSelect(event) {
|
||||||
var file = event.target.files[0];
|
var file = event.target.files[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
|
currentFileName = file.name;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function(e) {
|
reader.onload = function(e) {
|
||||||
var language = getFileLanguage(file.name);
|
var language = getFileLanguage(file.name);
|
||||||
|
@ -122,7 +126,7 @@
|
||||||
var blob = new Blob([text], { type: 'text/plain' });
|
var blob = new Blob([text], { type: 'text/plain' });
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.href = URL.createObjectURL(blob);
|
a.href = URL.createObjectURL(blob);
|
||||||
a.download = 'code.js';
|
a.download = currentFileName;
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user