diff --git a/demos/code/code.js b/demos/code/code.js index 3433bbc7e..cb2a529fa 100644 --- a/demos/code/code.js +++ b/demos/code/code.js @@ -365,12 +365,13 @@ Code.init = function() { el.style.width = (2 * bBox.width - el.offsetWidth) + 'px'; } // Make the 'Blocks' tab line up with the toolbox. - if (Code.workspace.toolbox_.width) { + if (Code.workspace && Code.workspace.toolbox_.width) { document.getElementById('tab_blocks').style.minWidth = (Code.workspace.toolbox_.width - 38) + 'px'; // Account for the 19 pixel margin and on each side. } }; + onresize(); window.addEventListener('resize', onresize, false); var toolbox = document.getElementById('toolbox'); @@ -398,7 +399,6 @@ Code.init = function() { } Code.tabClick(Code.selected); - Blockly.fireUiEvent(window, 'resize'); Code.bindClick('trashButton', function() {Code.discard(); Code.renderContent();}); @@ -422,7 +422,6 @@ Code.init = function() { function(name_) {return function() {Code.tabClick(name_);};}(name)); } - onresize(); // Lazy-load the syntax-highlighting. window.setTimeout(Code.importPrettify, 1); };