From bbb80c5243c419eda3cba8851473c0c8a577a580 Mon Sep 17 00:00:00 2001 From: Tina Quach Date: Thu, 18 Aug 2016 15:42:21 -0700 Subject: [PATCH] Blockly Factory: Warn ONLY if Using Standard Block Name (#567) * remove warning after user changes block type * nit comment * nit line length --- demos/blocklyfactory/factory.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/demos/blocklyfactory/factory.js b/demos/blocklyfactory/factory.js index ca7c98ae7..f881730ed 100644 --- a/demos/blocklyfactory/factory.js +++ b/demos/blocklyfactory/factory.js @@ -233,12 +233,14 @@ BlockFactory.updatePreview = function() { BlockFactory.previewWorkspace.clearUndo(); BlockFactory.updateGenerator(previewBlock); - // Warn user if their block type is already exists in Blockly's standard - // library. + // Warn user only if their block type is already exists in Blockly's + // standard library. + var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); if (BlockFactory.standardBlockTypes.indexOf(blockType) != -1) { - var rootBlock = FactoryUtils.getRootBlock(BlockFactory.mainWorkspace); rootBlock.setWarningText('A standard Blockly.Block already exists ' + 'under this name.'); + } else { + rootBlock.setWarningText(null); } } finally { Blockly.Blocks = backupBlocks;