mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
Update editor.html
This commit is contained in:
parent
4105b567ee
commit
6d601aa79f
|
@ -43,6 +43,10 @@
|
||||||
<span class="icon mif-floppy-disk"></span>
|
<span class="icon mif-floppy-disk"></span>
|
||||||
<span class="caption">Save File</span>
|
<span class="caption">Save File</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="ribbon-button" onclick="navigate('https://github.com/sponsors/gnh1201')">
|
||||||
|
<span class="icon mif-heart"></span>
|
||||||
|
<span class="caption">Sponsor</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -123,14 +127,26 @@
|
||||||
|
|
||||||
function saveFile() {
|
function saveFile() {
|
||||||
var text = editor.getValue();
|
var text = editor.getValue();
|
||||||
|
var fileName = prompt("Enter file name:", currentFileName);
|
||||||
|
if (!fileName) return;
|
||||||
|
|
||||||
|
currentFileName = fileName;
|
||||||
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 = currentFileName;
|
a.download = fileName;
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function navigate(href) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.href = href;
|
||||||
|
a.target = "_blank";
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user