mirror of
https://github.com/google/blockly.git
synced 2026-01-06 16:40:07 +01:00
Resize Code demo before injection to eliminate loading reflow.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user