From f0f7128aff2c22a21b862d4fd9491ff4afd26ec3 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Fri, 27 Jan 2017 09:39:31 -0500 Subject: [PATCH] Defer comment rendering if workspace not rendered When a Blockly workspace has not been rendered for the first time, e.g. due to Firefox SVG exceptions, the comment bubbles do not have a canvas to attach to. This fix sets a `visible` field on the comment object during load of a Blockly workspace that can be used to trigger an SVG update once the workspace has been rendered. --- core/comment.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/comment.js b/core/comment.js index 2121530c0..162a4f44b 100644 --- a/core/comment.js +++ b/core/comment.js @@ -165,6 +165,11 @@ Blockly.Comment.prototype.resizeBubble_ = function() { * @param {boolean} visible True if the bubble should be visible. */ Blockly.Comment.prototype.setVisible = function(visible) { + if (!this.block_.workspace.rendered) { + this.rendered = false; + this.visible = visible; + return; + } if (visible == this.isVisible()) { // No change. return;