Skip to content

Commit

Permalink
Merge pull request #2373 from google/rc/Apr_19
Browse files Browse the repository at this point in the history
April 2019 release candidate
  • Loading branch information
rachel-fenichel authored Apr 19, 2019
2 parents 82871b3 + 50ef963 commit 9c4f9d6
Show file tree
Hide file tree
Showing 190 changed files with 4,927 additions and 1,760 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"code": 100,
"tabWidth": 4,
"ignoreStrings": true,
"ignoreRegExpLiterals": true
"ignoreRegExpLiterals": true,
"ignoreUrls": true
}
],
"no-trailing-spaces": ["error", { "skipBlankLines": true }],
Expand Down
2 changes: 1 addition & 1 deletion appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
application: blockly-demo
version: 20190215
version: 20190419
runtime: python27
api_version: 1
threadsafe: no
Expand Down
4 changes: 2 additions & 2 deletions appengine/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ BlocklyStorage.monitorChanges_ = function(workspace) {
var xmlText = Blockly.Xml.domToText(xmlDom);
if (startXmlText != xmlText) {
window.location.hash = '';
workspace.removeChangeListener(bindData);
workspace.removeChangeListener(change);
}
}
var bindData = workspace.addChangeListener(change);
workspace.addChangeListener(change);
};

/**
Expand Down
572 changes: 321 additions & 251 deletions blockly_accessible_compressed.js

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions blockly_accessible_uncompressed.js

Large diffs are not rendered by default.

583 changes: 326 additions & 257 deletions blockly_compressed.js

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions blockly_uncompressed.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions blocks/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,21 @@ Blockly.Blocks['lists_split'] = {
* @this Blockly.Block
*/
updateType_: function(newMode) {
var mode = this.getFieldValue('MODE');
if (mode != newMode) {
this.setFieldValue(newMode, 'MODE');
var inputConnection = this.getInput('INPUT').connection;
inputConnection.setShadowDom(null);
var inputBlock = inputConnection.targetBlock();
if (inputBlock) {
inputConnection.disconnect();
if (inputBlock.isShadow()) {
inputBlock.dispose();
} else {
this.bumpNeighbours_();
}
}
}
if (newMode == 'SPLIT') {
this.outputConnection.setCheck('Array');
this.getInput('INPUT').setCheck('String');
Expand Down
6 changes: 6 additions & 0 deletions blocks/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
* @this Blockly.Block
*/
customContextMenu: function(options) {
if (!this.workspace.isMovable()) {
// If we center on the block and the workspace isn't movable we could
// loose blocks at the edges of the workspace.
return;
}

var option = {enabled: true};
option.text = Blockly.Msg['PROCEDURES_HIGHLIGHT_DEF'];
var name = this.getProcedureCall();
Expand Down
2 changes: 1 addition & 1 deletion blocks/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ Blockly.Constants.Text.QUOTE_IMAGE_MIXIN = {
* closing double quote. The selected quote will be adapted for RTL blocks.
* @param {boolean} open If the image should be open quote (“ in LTR).
* Otherwise, a closing quote is used (” in LTR).
* @returns {!Blockly.FieldImage} The new field.
* @return {!Blockly.FieldImage} The new field.
* @this Blockly.Block
*/
newQuote_: function(open) {
Expand Down
8 changes: 4 additions & 4 deletions blocks_compressed.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 20 additions & 16 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,21 @@ Blockly.Block.prototype.unplugFromRow_ = function(opt_healStack) {
};

/**
* Returns the connection on the only value input on the block, or null if the
* number of value inputs is not one.
* Returns the connection on the value input that is connected to another block.
* When an insertion marker is connected to a connection with a block already
* attached, the connected block is attached to the insertion marker.
* Since only one block can be displaced and attached to the insertion marker
* this should only ever return one connection.
*
* @return {Blockly.Connection} The connection on the value input, or null.
* @private
*/
Blockly.Block.prototype.getOnlyValueConnection_ = function() {
var connection = null;
for (var i = 0; i < this.inputList.length; i++) {
var thisConnection = this.inputList[i].connection;
if (thisConnection && thisConnection.type == Blockly.INPUT_VALUE) {
if (thisConnection && thisConnection.type == Blockly.INPUT_VALUE
&& thisConnection.targetConnection) {
if (connection) {
return null; // More than one value input found.
}
Expand Down Expand Up @@ -494,8 +499,8 @@ Blockly.Block.prototype.lastConnectionInStack = function() {
* @protected
*/
Blockly.Block.prototype.bumpNeighbours_ = function() {
console.warn('Not expected to reach this bumpNeighbours_ function. The ' +
'BlockSvg function for bumpNeighbours_ was expected to be called instead.');
console.warn('Not expected to reach Block.bumpNeighbours_ function. ' +
'BlockSvg.bumpNeighbours_ was expected to be called instead.');
};

/**
Expand Down Expand Up @@ -814,7 +819,7 @@ Blockly.Block.prototype.setConnectionsHidden = function(hidden) {
* Used to match connections between a block and its insertion marker.
* @param {!Blockly.Block} otherBlock The other block to match against.
* @param {!Blockly.Connection} conn The other connection to match.
* @return {Blockly.Connection} the matching connection on this block, or null.
* @return {Blockly.Connection} The matching connection on this block, or null.
* @package
*/
Blockly.Block.prototype.getMatchingConnection = function(otherBlock, conn) {
Expand Down Expand Up @@ -912,7 +917,7 @@ Blockly.Block.prototype.setColour = function(colour) {
if (colour != dereferenced) {
errorMsg += ' (from "' + colour + '")';
}
throw errorMsg;
throw Error(errorMsg);
}
};

Expand All @@ -925,7 +930,7 @@ Blockly.Block.prototype.setStyle = function(blockStyleName) {
var theme = Blockly.getTheme();
if (!theme) {
throw Error('Trying to set block style to ' + blockStyleName +
' before theme was defined via Blockly.setTheme().');
' before theme was defined via Blockly.setTheme().');
}
var blockStyle = theme.getBlockStyle(blockStyleName);
this.styleName_ = blockStyleName;
Expand All @@ -936,8 +941,7 @@ Blockly.Block.prototype.setStyle = function(blockStyleName) {
this.hat = blockStyle.hat;
// Set colour will trigger an updateColour() on a block_svg
this.setColour(blockStyle['colourPrimary']);
}
else {
} else {
throw Error('Invalid style name: ' + blockStyleName);
}
};
Expand Down Expand Up @@ -1428,13 +1432,13 @@ Blockly.Block.prototype.jsonInit = function(json) {
Blockly.Block.prototype.jsonInitColour_ = function(json, warningPrefix) {
if ('colour' in json) {
if (json['colour'] === undefined) {
console.warn(warningPrefix + 'Undefined color value.');
console.warn(warningPrefix + 'Undefined colour value.');
} else {
var rawValue = json['colour'];
try {
this.setColour(rawValue);
} catch (colorError) {
console.warn(warningPrefix + 'Illegal color value: ', rawValue);
} catch (e) {
console.warn(warningPrefix + 'Illegal colour value: ', rawValue);
}
}
}
Expand Down Expand Up @@ -1477,7 +1481,7 @@ Blockly.Block.prototype.mixin = function(mixinObj, opt_disableCheck) {
}
if (overwrites.length) {
throw Error('Mixin will overwrite block members: ' +
JSON.stringify(overwrites));
JSON.stringify(overwrites));
}
}
goog.mixin(this, mixinObj);
Expand All @@ -1488,8 +1492,8 @@ Blockly.Block.prototype.mixin = function(mixinObj, opt_disableCheck) {
* @param {string} message Text contains interpolation tokens (%1, %2, ...)
* that match with fields or inputs defined in the args array.
* @param {!Array} args Array of arguments to be interpolated.
* @param {string=} lastDummyAlign If a dummy input is added at the end,
* how should it be aligned?
* @param {string|undefined} lastDummyAlign If a dummy input is added at the
* end, how should it be aligned?
* @private
*/
Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) {
Expand Down
2 changes: 1 addition & 1 deletion core/block_dragger.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Blockly.BlockDragger.prototype.fireMoveEvent_ = function() {
/**
* Shut the trash can and, if necessary, delete the dragging block.
* Should be called at the end of a block drag.
* @return {boolean} whether the block was deleted.
* @return {boolean} Whether the block was deleted.
* @private
*/
Blockly.BlockDragger.prototype.maybeDeleteBlock_ = function() {
Expand Down
2 changes: 1 addition & 1 deletion core/block_render_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) {
this.squareTopLeftCorner_ = true;
this.squareBottomLeftCorner_ = true;
} else {
var renderCap = typeof this.hat !== undefined ? this.hat === 'cap' :
var renderCap = this.hat ? this.hat === 'cap' :
Blockly.BlockSvg.START_HAT;

this.squareTopLeftCorner_ = false;
Expand Down
5 changes: 2 additions & 3 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,9 @@ Blockly.BlockSvg.prototype.setBorderColour_ = function(rgb, colourTertiary) {
* Sets the colour of shadow blocks.
* @param {!string} rgb Primary colour of the block.
* @param {?string} colourSecondary Colour for shadow block.
* @return {!string} hexColour The background color of the block.
* @return {!string} The background colour of the block.
*/
Blockly.BlockSvg.prototype.setShadowColour_ = function(
rgb, colourSecondary) {
Blockly.BlockSvg.prototype.setShadowColour_ = function(rgb, colourSecondary) {
var hexColour;
if (colourSecondary) {
this.svgPathLight_.style.display = 'none';
Expand Down
Loading

0 comments on commit 9c4f9d6

Please sign in to comment.