mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Add To Playground
This commit is contained in:
parent
05a827c0ea
commit
39e71aa4f4
1 changed files with 7 additions and 8 deletions
|
@ -52,9 +52,9 @@
|
|||
<button id="projectLoadButton">Load</button>
|
||||
<button id="createEmptyProject">New Project</button><br />
|
||||
<p>
|
||||
<input type="button" value="Export to XML" onclick="toXml()">
|
||||
<input type="button" value="Export to JSON" onclick="toJson()">
|
||||
|
||||
<input type="button" value="Import from XML" onclick="fromXml()" id="import">
|
||||
<input type="button" value="Import from JSON" onclick="fromJson()" id="import">
|
||||
<br /><br />
|
||||
<textarea id="importExport"></textarea>
|
||||
</p>
|
||||
|
@ -70,18 +70,17 @@
|
|||
<!-- Playground -->
|
||||
<script src="./playground.js"></script>
|
||||
<script>
|
||||
function toXml() {
|
||||
function toJson() {
|
||||
var output = document.getElementById('importExport');
|
||||
var xml = Blockly.Xml.workspaceToDom(workspace);
|
||||
output.value = Blockly.Xml.domToPrettyText(xml);
|
||||
var json = window.vm.toJSON(workspace);
|
||||
output.value = json;
|
||||
output.focus();
|
||||
output.select();
|
||||
}
|
||||
|
||||
function fromXml() {
|
||||
function fromJson() {
|
||||
var input = document.getElementById('importExport');
|
||||
var xml = Blockly.Xml.textToDom(input.value);
|
||||
Blockly.Xml.domToWorkspace(workspace, xml);
|
||||
window.vm.fromJSON(input.value);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue