mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user