Skip to content

Commit

Permalink
close #3
Browse files Browse the repository at this point in the history
  • Loading branch information
bestian committed May 14, 2024
1 parent 0b2ed7b commit ffbec0f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 9 deletions.
24 changes: 21 additions & 3 deletions demo_de.html
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,32 @@
function saveWorkspaceToDownload() {
var xml = Blockly.Xml.workspaceToDom(workspace);
var xml_text = Blockly.Xml.domToText(xml);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(xml_text), 'webseite.blockly.xml');
var blob = new Blob([xml_text], {type: "text/xml"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.blockly.xml'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

function saveHtmlToDownload() {
var code = HtmlGenerator.workspaceToCode(workspace);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(code), 'webseite.html');
var blob = new Blob([code], {type: "text/html"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.html'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}

document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

document.getElementById("exportButton").onclick = saveHtmlToDownload;


Expand Down
24 changes: 21 additions & 3 deletions demo_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,32 @@
function saveWorkspaceToDownload() {
var xml = Blockly.Xml.workspaceToDom(workspace);
var xml_text = Blockly.Xml.domToText(xml);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(xml_text), 'webseite.blockly.xml');
var blob = new Blob([xml_text], {type: "text/xml"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.blockly.xml'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

function saveHtmlToDownload() {
var code = HtmlGenerator.workspaceToCode(workspace);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(code), 'webseite.html');
var blob = new Blob([code], {type: "text/html"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.html'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}

document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

document.getElementById("exportButton").onclick = saveHtmlToDownload;


Expand Down
24 changes: 21 additions & 3 deletions demo_zh-hant.html
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,32 @@
function saveWorkspaceToDownload() {
var xml = Blockly.Xml.workspaceToDom(workspace);
var xml_text = Blockly.Xml.domToText(xml);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(xml_text), 'webseite.blockly.xml');
var blob = new Blob([xml_text], {type: "text/xml"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.blockly.xml'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

function saveHtmlToDownload() {
var code = HtmlGenerator.workspaceToCode(workspace);
newWindow = window.open("data:application/octet-stream," + encodeURIComponent(code), 'webseite.html');
var blob = new Blob([code], {type: "text/html"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'webseite.html'; // Specify the file name and extension
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}

document.getElementById("saveButton").onclick = saveWorkspaceToDownload;

document.getElementById("exportButton").onclick = saveHtmlToDownload;


Expand Down

0 comments on commit ffbec0f

Please sign in to comment.