mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Add $ back into the ID soup. Issue #251.
This commit is contained in:
@@ -187,8 +187,9 @@ Blockly.Generator.prototype.blockToCode = function(block) {
|
|||||||
'Expecting string from statement block "%s".', block.type);
|
'Expecting string from statement block "%s".', block.type);
|
||||||
return [this.scrub_(block, code[0]), code[1]];
|
return [this.scrub_(block, code[0]), code[1]];
|
||||||
} else if (goog.isString(code)) {
|
} else if (goog.isString(code)) {
|
||||||
|
var id = block.id.replace(/\$/g, '$$$$'); // Issue 251.
|
||||||
if (this.STATEMENT_PREFIX) {
|
if (this.STATEMENT_PREFIX) {
|
||||||
code = this.STATEMENT_PREFIX.replace(/%1/g, '\'' + block.id + '\'') +
|
code = this.STATEMENT_PREFIX.replace(/%1/g, '\'' + id + '\'') +
|
||||||
code;
|
code;
|
||||||
}
|
}
|
||||||
return this.scrub_(block, code);
|
return this.scrub_(block, code);
|
||||||
@@ -297,6 +298,7 @@ Blockly.Generator.prototype.statementToCode = function(block, name) {
|
|||||||
* @return {string} Loop contents, with infinite loop trap added.
|
* @return {string} Loop contents, with infinite loop trap added.
|
||||||
*/
|
*/
|
||||||
Blockly.Generator.prototype.addLoopTrap = function(branch, id) {
|
Blockly.Generator.prototype.addLoopTrap = function(branch, id) {
|
||||||
|
id = id.replace(/\$/g, '$$$$'); // Issue 251.
|
||||||
if (this.INFINITE_LOOP_TRAP) {
|
if (this.INFINITE_LOOP_TRAP) {
|
||||||
branch = this.INFINITE_LOOP_TRAP.replace(/%1/g, '\'' + id + '\'') + branch;
|
branch = this.INFINITE_LOOP_TRAP.replace(/%1/g, '\'' + id + '\'') + branch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -543,12 +543,13 @@ Blockly.genUid = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Legal characters for the unique ID.
|
* Legal characters for the unique ID. Should be all on a US keyboard.
|
||||||
* Should be all on a US keyboard. No XML special characters or control codes.
|
* No characters that conflict with XML or JSON. Requests to remove additional
|
||||||
* Removed $ due to issue 251.
|
* 'problematic' characters from this soup will be denied. That's your failure
|
||||||
|
* to properly escape in your own environment. Issues #251, #625, #682.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Blockly.genUid.soup_ = '!#%()*+,-./:;=?@[]^_`{|}~' +
|
Blockly.genUid.soup_ = '!#$%()*+,-./:;=?@[]^_`{|}~' +
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1305,7 +1305,8 @@ Blockly.WorkspaceSvg.prototype.updateGridPattern_ = function() {
|
|||||||
* .flyoutWidth: Width of the flyout if it is always open. Otherwise zero.
|
* .flyoutWidth: Width of the flyout if it is always open. Otherwise zero.
|
||||||
* .flyoutHeight: Height of flyout if it is always open. Otherwise zero.
|
* .flyoutHeight: Height of flyout if it is always open. Otherwise zero.
|
||||||
* .toolboxPosition: Top, bottom, left or right.
|
* .toolboxPosition: Top, bottom, left or right.
|
||||||
* @return {Object} Contains size and position metrics of a top level workspace.
|
* @return {!Object} Contains size and position metrics of a top level
|
||||||
|
* workspace.
|
||||||
* @private
|
* @private
|
||||||
* @this Blockly.WorkspaceSvg
|
* @this Blockly.WorkspaceSvg
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ Blockly.Blocks['unittest_adjustindex'] = {
|
|||||||
"output": "Number",
|
"output": "Number",
|
||||||
"colour": 65,
|
"colour": 65,
|
||||||
"tooltip": "Adjusts the value based on whether generated code is using " +
|
"tooltip": "Adjusts the value based on whether generated code is using " +
|
||||||
"zero or one based indexing"
|
"zero or one based indexing."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user