Blockly Factory: Warn ONLY if Using Standard Block Name (#567)

* remove warning after user changes block type

* nit comment

* nit line length
This commit is contained in:
Tina Quach
2016-08-18 15:42:21 -07:00
committed by picklesrus
parent 394b618a67
commit bbb80c5243

View File

@@ -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;