Commit 0c3dad0e authored by Neil Fraser's avatar Neil Fraser

Resize Code demo before injection to eliminate loading reflow.

parent 3f8e586f
......@@ -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);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment