mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-07 12:16:04 +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="caption">Save File</span>
|
||||
</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>
|
||||
</nav>
|
||||
|
@ -123,14 +127,26 @@
|
|||
|
||||
function saveFile() {
|
||||
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 a = document.createElement('a');
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = currentFileName;
|
||||
a.download = fileName;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user