Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: playground test blocks, text area listeners, and show/hide buttons #6015

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions tests/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!-- This script loads uncompressed when on localhost and loads compressed when it is being hosted.
Please add any other dependencies to playgrounds/prepare.js.-->
<script src="playgrounds/prepare.js"></script>
<script src="../node_modules/@blockly/dev-tools/dist/index.js"></script>
<script type=module>
import Blockly from './playgrounds/blockly.mjs';

Expand Down Expand Up @@ -85,7 +86,7 @@
load();
}

addClickHandlers();
addEventHandlers();
}

function setBackgroundColour() {
Expand Down Expand Up @@ -387,7 +388,7 @@
// automatically deferred, so it will not be run until after the
// document has been parsed, but before firing DOMContentLoaded.

function addClickHandlers() {
function addEventHandlers() {
document.getElementById('save-json').addEventListener('click', saveJson);
document.getElementById('save-xml').addEventListener('click', saveXml);
document.getElementById('import').addEventListener('click', load);
Expand All @@ -414,6 +415,14 @@
.addEventListener('click', function() { logEvents(this.checked) });
document.getElementById('logFlyoutCheck')
.addEventListener('click', function() { logFlyoutEvents(this.checked) });

document.getElementById('importExport').addEventListener('change', taChange);
document.getElementById('importExport').addEventListener('keyup', taChange);

document.getElementById('show')
.addEventListener('click', function() { workspace.setVisible(true); });
document.getElementById('hide')
.addEventListener('click', function() { workspace.setVisible(false); });
}

start();
Expand Down Expand Up @@ -469,9 +478,11 @@

<h1>Blockly Playground</h1>

<p><a href="javascript:void(workspace.setVisible(true))">Show</a>
- <a href="javascript:void(workspace.setVisible(false))">Hide</a>
- <a href="playgrounds/advanced_playground.html">Advanced</a></p>
<p>
<input id="show" type="button" value="Show"></input> -
<input id="hide" type="button" value="Hide"></input> -
<a href="playgrounds/advanced_playground.html">Advanced</a>
</p>

<form id="options">
<select name="dir" onchange="document.forms.options.submit()">
Expand All @@ -496,8 +507,7 @@ <h1>Blockly Playground</h1>
<input id="to-code-lua" type="button" value="To Lua">
<input id="to-code-dart" type="button" value="To Dart">
<br>
<textarea id="importExport" style="width: 26%; height: 12em"
onchange="taChange();" onkeyup="taChange()"></textarea>
<textarea id="importExport" style="width: 26%; height: 12em"></textarea>
</p>

<p>
Expand Down