mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Cleaned up unamed handling w/ safename.
This commit is contained in:
@@ -172,7 +172,7 @@ Blockly.Names.prototype.getDistinctName = function(name, type) {
|
||||
*/
|
||||
Blockly.Names.prototype.safeName_ = function(name) {
|
||||
if (!name) {
|
||||
name = 'unnamed';
|
||||
name = Blockly.Msg['UNNAMED_KEY'] || 'unnamed';
|
||||
} else {
|
||||
// Unfortunately names in non-latin characters will look like
|
||||
// _E9_9F_B3_E4_B9_90 which is pretty meaningless.
|
||||
|
||||
@@ -103,7 +103,7 @@ Blockly.Procedures.findLegalName = function(name, block) {
|
||||
// Flyouts can have multiple procedures called 'do something'.
|
||||
return name;
|
||||
}
|
||||
name = name || Blockly.Msg['UNNAMED_KEY'];
|
||||
name = name || Blockly.Msg['UNNAMED_KEY'] || 'unnamed';
|
||||
while (!Blockly.Procedures.isLegalName_(name, block.workspace, block)) {
|
||||
// Collision with another procedure.
|
||||
var r = name.match(/^(.*?)(\d+)$/);
|
||||
|
||||
Reference in New Issue
Block a user