diff --git a/core/block.js b/core/block.js index 827887e1d..c61bc1280 100644 --- a/core/block.js +++ b/core/block.js @@ -279,6 +279,20 @@ Blockly.Block.prototype.colourTertiary_ = null; */ Blockly.Block.prototype.styleName_ = null; +/** + * An optional method called during initialization. + * @type {?function()} + */ +Blockly.Block.prototype.init; + +/** + * An optional callback method to use whenever the block's parent workspace + * changes. This is usually only called from the constructor, the block type + * initializer function, or an extension initializer function. + * @type {?function(Blockly.Events.Abstract)} + */ +Blockly.Block.prototype.onchange; + /** * An optional serialization method for defining how to serialize the * mutation state. This must be coupled with defining `domToMutation`. diff --git a/core/block_svg.js b/core/block_svg.js index a1fb14f09..ebbba039c 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -238,6 +238,12 @@ Blockly.BlockSvg.prototype.decompose; */ Blockly.BlockSvg.prototype.compose; +/** + * An optional method for defining custom block context menu items. + * @type {?function(!Array.)} + */ +Blockly.BlockSvg.prototype.customContextMenu; + /** * An property used internally to reference the block's rendering debugger. * @type {?Blockly.blockRendering.Debug} diff --git a/core/connection.js b/core/connection.js index 91227f424..fabc9fff6 100644 --- a/core/connection.js +++ b/core/connection.js @@ -606,7 +606,6 @@ Blockly.Connection.prototype.targetBlock = function() { * value type system. E.g. square_root("Hello") is not compatible. * @param {!Blockly.Connection} otherConnection Connection to compare against. * @return {boolean} True if the connections share a type. - * @package */ Blockly.Connection.prototype.checkType = function(otherConnection) { if (!this.check_ || !otherConnection.check_) { diff --git a/core/contextmenu.js b/core/contextmenu.js index 48aa337ea..efbf0c981 100644 --- a/core/contextmenu.js +++ b/core/contextmenu.js @@ -300,12 +300,10 @@ Blockly.ContextMenu.blockCommentOption = function(block) { * right-click originated. * @return {!Object} A menu option, containing text, enabled, and a callback. * @package - * @suppress {checkTypes} Suppress checks while workspace comments are not - * bundled in. */ Blockly.ContextMenu.commentDeleteOption = function(comment) { var deleteOption = { - text: Blockly.Msg.REMOVE_COMMENT, + text: Blockly.Msg['REMOVE_COMMENT'], enabled: true, callback: function() { Blockly.Events.setGroup(true); @@ -322,12 +320,10 @@ Blockly.ContextMenu.commentDeleteOption = function(comment) { * right-click originated. * @return {!Object} A menu option, containing text, enabled, and a callback. * @package - * @suppress {checkTypes} Suppress checks while workspace comments are not - * bundled in. */ Blockly.ContextMenu.commentDuplicateOption = function(comment) { var duplicateOption = { - text: Blockly.Msg.DUPLICATE_COMMENT, + text: Blockly.Msg['DUPLICATE_COMMENT'], enabled: true, callback: function() { Blockly.duplicate(comment); @@ -354,7 +350,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) { // location of the mouse event. var addWsComment = function() { var comment = new Blockly.WorkspaceCommentSvg( - ws, Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT, + ws, Blockly.Msg['WORKSPACE_COMMENT_DEFAULT_TEXT'], Blockly.WorkspaceCommentSvg.DEFAULT_SIZE, Blockly.WorkspaceCommentSvg.DEFAULT_SIZE); @@ -394,7 +390,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) { // that they won't be able to edit. enabled: !Blockly.utils.userAgent.IE }; - wsCommentOption.text = Blockly.Msg.ADD_COMMENT; + wsCommentOption.text = Blockly.Msg['ADD_COMMENT']; wsCommentOption.callback = function() { addWsComment(); }; diff --git a/core/field.js b/core/field.js index 27c0b6220..ee7cc7d17 100644 --- a/core/field.js +++ b/core/field.js @@ -259,7 +259,7 @@ Blockly.Field.prototype.SERIALIZABLE = false; /** * Point size of text. Should match blocklyText's font-size in CSS. - * @const {string} + * @const {number} */ Blockly.Field.FONTSIZE = 11; diff --git a/core/keyboard_nav/ast_node.js b/core/keyboard_nav/ast_node.js index 2721b8c4e..da885b59f 100644 --- a/core/keyboard_nav/ast_node.js +++ b/core/keyboard_nav/ast_node.js @@ -23,6 +23,8 @@ goog.provide('Blockly.ASTNode'); +goog.require('Blockly.utils.Coordinate'); + /** * Class for an AST node. diff --git a/core/renderers/measurables/connections.js b/core/renderers/measurables/connections.js index 098c3f5d7..abcc75070 100644 --- a/core/renderers/measurables/connections.js +++ b/core/renderers/measurables/connections.js @@ -47,7 +47,7 @@ Blockly.blockRendering.Connection = function(constants, connectionModel) { constants); this.connectionModel = connectionModel; this.shape = this.constants_.shapeFor(connectionModel); - this.isDynamicShape = !!this.shape.isDynamic; + this.isDynamicShape = !!this.shape['isDynamic']; this.type |= Blockly.blockRendering.Types.CONNECTION; }; Blockly.utils.object.inherits(Blockly.blockRendering.Connection, diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index 9ddc7fc51..b8a2dfd90 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -252,11 +252,7 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) { }; /** - * Create a spacer row to go between prev and next, and set its size. - * @param {?Blockly.blockRendering.Row} prev The previous row, or null. - * @param {?Blockly.blockRendering.Row} next The next row, or null. - * @return {!Blockly.blockRendering.SpacerRow} The newly created spacer row. - * @protected + * @override */ Blockly.zelos.RenderInfo.prototype.makeSpacerRow_ = function(prev, next) { var height = this.getSpacerRowHeight_(prev, next); diff --git a/core/utils/dom.js b/core/utils/dom.js index dfacc4188..a659cfe08 100644 --- a/core/utils/dom.js +++ b/core/utils/dom.js @@ -284,7 +284,7 @@ Blockly.utils.dom.getTextWidth = function(textElement) { * This method requires that we know the text element's font family and size in * advance. Similar to `getTextWidth`, we cache the width we compute. * @param {!Element} textElement An SVG 'text' element. - * @param {string} fontSize The font size to use. + * @param {number} fontSize The font size to use. * @param {string} fontFamily The font family to use. * @return {number} Width of element. */ diff --git a/core/workspace_svg.js b/core/workspace_svg.js index a4af7e3c8..9efe86b06 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -44,6 +44,8 @@ goog.require('Blockly.WorkspaceAudio'); goog.require('Blockly.WorkspaceDragSurfaceSvg'); goog.require('Blockly.Xml'); +goog.requireType('Blockly.blockRendering.Renderer'); + /** * Class for a workspace. This is an onscreen area with optional trashcan, @@ -1308,7 +1310,6 @@ Blockly.WorkspaceSvg.prototype.refreshToolboxSelection = function() { * flyout to show the renamed variable immediately. * @param {string} id ID of the variable to rename. * @param {string} newName New variable name. - * @package */ Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) { Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this, id, newName); @@ -1319,7 +1320,6 @@ Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) { * Delete a variable by the passed in ID. Update the flyout to show * immediately that the variable is deleted. * @param {string} id ID of variable to delete. - * @package */ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) { Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this, id); @@ -1336,7 +1336,6 @@ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) { * @param {?string=} opt_id The unique ID of the variable. This will default to * a UUID. * @return {!Blockly.VariableModel} The newly created variable. - * @package */ Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id) { @@ -1465,7 +1464,6 @@ Blockly.WorkspaceSvg.prototype.isContentBounded = function() { * the mouse position). This does not include zooming with the zoom controls * since the X Y coordinates are decided programmatically. * @return {boolean} True if the workspace is movable, false otherwise. - * @package */ Blockly.WorkspaceSvg.prototype.isMovable = function() { return (this.options.moveOptions && this.options.moveOptions.scrollbars) || @@ -2265,7 +2263,7 @@ Blockly.WorkspaceSvg.getContentDimensionsBounded_ = function(ws, svgSize) { * @return {!Object} Contains size and position metrics of a top level * workspace. * @private - * @this Blockly.WorkspaceSvg + * @this {Blockly.WorkspaceSvg} */ Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() { @@ -2347,7 +2345,7 @@ Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() { * @param {!Object} xyRatio Contains an x and/or y property which is a float * between 0 and 1 specifying the degree of scrolling. * @private - * @this Blockly.WorkspaceSvg + * @this {Blockly.WorkspaceSvg} */ Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function(xyRatio) { var metrics = this.getMetrics();