Fix regular expressions.

1) Simplifications.
2) Enable toolbox category colours to be specified using the full range of CSS formats (not just hue or #rrggbb).
3) Fix bug where `Blockly.utils.checkMessageReferences('%{BKY_today}  %{BKY_xxx}')` returns true.
This commit is contained in:
Neil Fraser
2019-06-10 11:03:22 -07:00
parent 0213de11bc
commit aca1a43ec8
6 changed files with 31 additions and 35 deletions

View File

@@ -399,7 +399,7 @@ Blockly.Variables.promptName = function(promptText, defaultText, callback) {
// Merge runs of whitespace. Strip leading and trailing whitespace.
// Beyond this, all names are legal.
if (newVar) {
newVar = newVar.replace(/[\s\xa0]+/g, ' ').replace(/^ | $/g, '');
newVar = newVar.replace(/[\s\xa0]+/g, ' ').trim();
if (newVar == Blockly.Msg['RENAME_VARIABLE'] ||
newVar == Blockly.Msg['NEW_VARIABLE']) {
// Ok, not ALL names are legal...