Fixed live rendering not always happening on load

This commit is contained in:
Remy Sharp 2012-06-22 17:45:13 +01:00
parent c49a34d495
commit e40bb70232
2 changed files with 12 additions and 14 deletions

View File

@ -287,14 +287,10 @@ var panelInit = {
},
live: function () {
function show() {
var panel = this;
$document.bind('jsbinReady', function () {
if (panel.visible) {
renderLivePreview(true);
}
});
renderLivePreview();
// var panel = this;
if (panels.ready) {
renderLivePreview();
}
}
function hide() {
@ -318,9 +314,11 @@ editors.live = panelInit.live();
// jsconsole.init(); // sets up render functions etc.
editors.live.settings.render = function () {
editors.console.render();
renderLivePreview();
editors.live.settings.render = function (showAlerts) {
if (panels.ready) {
editors.console.render();
renderLivePreview(showAlerts);
}
};
// IMPORTANT this is nasty, but the sequence is important, because the
@ -415,7 +413,7 @@ var editorsReady = setInterval(function () {
// if live is visible, render it
if (panels.panels.live.visible) {
panels.panels.live.render();
panels.panels.live.render(true);
}
if (panels.panels.console.visible) {

View File

@ -128,7 +128,6 @@ Panel.prototype = {
$body.addClass('panelsVisible');
panel.visible = true;
if (panel.settings.show) {
panel.settings.show.call(panel, true);
}
@ -137,6 +136,7 @@ Panel.prototype = {
// update the splitter - but do it on the next tick
// required to allow the splitter to see it's visible first
setTimeout(function () {
panel.visible = true;
if (x !== undefined) {
panel.splitter.trigger('init', x);
} else {
@ -226,7 +226,7 @@ Panel.prototype = {
if (panel.editor) {
return panel.processor(panel.getCode());
} else if (this.visible && this.settings.render) {
this.settings.render.call(this);
this.settings.render.apply(this, arguments);
}
},
init: function () {