Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
],
"dependencies": {
"@blockly/continuous-toolbox": "^1.0.4",
"blockly": ">=5.20210325.0",
"@blockly/dev-tools": "latest"
"@blockly/dev-tools": "latest",
"@blockly/keyboard-navigation": "^0.1.7",
"blockly": ">=5.20210325.0"
},
"devDependencies": {
"copy-webpack-plugin": "^5.1.1",
Expand Down
4 changes: 3 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

#root {
height: 100%;
height: 90%;
}
.blocklyFlyout{
border-right: 1px solid hsla(0, 0%, 0%, 0.15);
Expand Down Expand Up @@ -41,6 +41,8 @@
<button id="darkTheme">dark mode</button>
<button id="wackadoodleTheme">Wackadoodle</button>
<button id="openDyslexic">openDyslexicFont</button>
<button id="enableKeyboard">enablekeyboard</button>
<button id="disableKeyboard">disablekeyboard</button>
</div>
</div>
<div id="root"></div>
Expand Down
17 changes: 14 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as Blockly from 'blockly';
// I haven't figured out how to import this file properly so the themes are here.
// TODO: move them back into separate files.
//import Theme from './src/default_theme';

import {NavigationController} from '@blockly/keyboard-navigation';

// TODO Fix up all the other blocks files. They need:
// * to have their style set correclty.
Expand Down Expand Up @@ -39,6 +38,8 @@ import openDyslexicTheme from './themes/openDyslexic_theme.js';
import toolboxXmlObject from './toolbox.js';
const toolboxXml = toolboxXmlObject.toolbox;

const navControl = new NavigationController();

/**
* Create a workspace.
* @param {HTMLElement} blocklyDiv The blockly container div.
Expand All @@ -63,6 +64,12 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById("openDyslexic").addEventListener("click", function() {
workspace.setTheme(openDyslexicTheme);
});
document.getElementById("enableKeyboard").addEventListener("click", function() {
navControl.enable(workspace);
});
document.getElementById("disableKeyboard").addEventListener("click", function() {
navControl.disable(workspace);
});

const defaultOptions = {
move: {
Expand Down Expand Up @@ -94,4 +101,8 @@ document.addEventListener('DOMContentLoaded', function() {
workspace = Blockly.inject('root',
defaultOptions);
//createPlayground(document.getElementById('root'), createWorkspace, defaultOptions);

navControl.init();
navControl.addWorkspace(workspace);
//navControl.enable(workspace);
});