XML Import/Export ()

* Added Import/Export Area In Block Representations (Copied Some Code From scratch-blocks)

* Better TextArea Size For XML

* Made Import/Export It's Own Catatagory 1/3

* Made Import/Export It's Own Catatagory 2/3

* Made Import/Export It's Own Catatagory 3/3

* Added A Newline

* Removed Port 80 From StartServerWindows.bat

* </a> before <br />

* Removed taChange from HTML

* No More taChange()
This commit is contained in:
TheBrokenRail 2016-09-02 08:27:43 -04:00 committed by Tim Mickel
parent 220d614a9d
commit 4586507a8a
4 changed files with 42 additions and 4 deletions

View file

@ -1,2 +1,2 @@
@echo off
node_modules\.bin\webpack-dev-server --host 0.0.0.0 --port 80 --content-base .\
node_modules\.bin\webpack-dev-server --host 0.0.0.0 --content-base .

View file

@ -15,7 +15,8 @@
<p>
<a id="renderexplorer-link" href="#">Renderer</a><br />
<a id="threadexplorer-link" href="#">VM Threads</a><br />
<a id="blockexplorer-link" href="#">VM Block Representation</a>
<a id="blockexplorer-link" href="#">VM Block Representation</a><br />
<a id="importexport-link" href="#">Import/Export XML</a>
</p>
<div id="tab-renderexplorer">
Render<br />
@ -29,6 +30,16 @@
Block explorer
<pre id="blockexplorer"></pre>
</div>
<div id="tab-importexport">
Import/Export XML
<p>
<input type="button" value="Export to XML" onclick="toXml()">
&nbsp;
<input type="button" value="Import from XML" onclick="fromXml()" id="import">
<br><br>
<textarea id="importExport" style="width: 480px; height: 360px"></textarea>
</p>
</div>
</div>
<div id="blocks"></div>
@ -741,5 +752,20 @@
<script src="../vm.worker.js"></script>
<!-- Playground -->
<script src="./playground.js"></script>
<script>
function toXml() {
var output = document.getElementById('importExport');
var xml = Blockly.Xml.workspaceToDom(workspace);
output.value = Blockly.Xml.domToPrettyText(xml);
output.focus();
output.select();
}
function fromXml() {
var input = document.getElementById('importExport');
var xml = Blockly.Xml.textToDom(input.value);
Blockly.Xml.domToWorkspace(workspace, xml);
}
</script>
</body>
</html>

View file

@ -20,7 +20,7 @@ a {
bottom: 0;
width: 35%;
}
#blockexplorer, #threadexplorer {
#blockexplorer, #threadexplorer, #importexport {
position: absolute;
width: 100%;
height: 75%;
@ -32,6 +32,6 @@ a {
font-size: 10pt;
}
#tab-blockexplorer, #tab-threadexplorer {
#tab-blockexplorer, #tab-threadexplorer, #tab-importexport {
display: none;
}

View file

@ -129,6 +129,7 @@ window.onload = function() {
var tabBlockExplorer = document.getElementById('tab-blockexplorer');
var tabThreadExplorer = document.getElementById('tab-threadexplorer');
var tabRenderExplorer = document.getElementById('tab-renderexplorer');
var tabImportExport = document.getElementById('tab-importexport');
// Handlers to show different explorers.
document.getElementById('threadexplorer-link').addEventListener('click',
@ -138,6 +139,7 @@ window.onload = function() {
tabBlockExplorer.style.display = 'none';
tabRenderExplorer.style.display = 'none';
tabThreadExplorer.style.display = 'block';
tabImportExport.style.display = 'none';
});
document.getElementById('blockexplorer-link').addEventListener('click',
function () {
@ -146,6 +148,7 @@ window.onload = function() {
tabBlockExplorer.style.display = 'block';
tabRenderExplorer.style.display = 'none';
tabThreadExplorer.style.display = 'none';
tabImportExport.style.display = 'none';
});
document.getElementById('renderexplorer-link').addEventListener('click',
function () {
@ -153,5 +156,14 @@ window.onload = function() {
tabBlockExplorer.style.display = 'none';
tabRenderExplorer.style.display = 'block';
tabThreadExplorer.style.display = 'none';
tabImportExport.style.display = 'none';
});
document.getElementById('importexport-link').addEventListener('click',
function () {
window.exploreTabOpen = false;
tabBlockExplorer.style.display = 'none';
tabRenderExplorer.style.display = 'none';
tabThreadExplorer.style.display = 'none';
tabImportExport.style.display = 'block';
});
};