From a2e6cfffcc42e34968fc82f1ae2307c3c1d34954 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 27 Sep 2019 11:40:55 -0700 Subject: [PATCH] Block comments from XML not fatal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …if Blockly.Comment was not compiled in. --- core/xml.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/xml.js b/core/xml.js index 51a182b3c..f152f0a0f 100644 --- a/core/xml.js +++ b/core/xml.js @@ -433,14 +433,14 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) { if (workspace.rendered) { if (!Blockly.WorkspaceCommentSvg) { console.warn('Missing require for Blockly.WorkspaceCommentSvg, ' + - 'ignoring comment block.'); + 'ignoring workspace comment.'); } else { Blockly.WorkspaceCommentSvg.fromXml(xmlChild, workspace, width); } } else { if (!Blockly.WorkspaceComment) { console.warn('Missing require for Blockly.WorkspaceComment, ' + - 'ignoring comment block.'); + 'ignoring workspace comment.'); } else { Blockly.WorkspaceComment.fromXml(xmlChild, workspace); } @@ -668,6 +668,11 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) { } break; case 'comment': + if (!Blockly.Comment) { + console.warn('Missing require for Blockly.Comment, ' + + 'ignoring block comment.'); + break; + } var text = xmlChild.textContent; var pinned = xmlChild.getAttribute('pinned') == 'true'; var width = parseInt(xmlChild.getAttribute('w'), 10);