diff --git a/core/block.js b/core/block.js index 0b0226035..082ca4296 100644 --- a/core/block.js +++ b/core/block.js @@ -290,6 +290,19 @@ const Block = function(workspace, prototypeName, opt_id) { /** @type {?boolean} */ this.rendered = null; + /** + * String for block help, or function that returns a URL. Null for no help. + * @type {string|Function} + */ + this.helpUrl = null; + + /** + * A bound callback function to use when the parent workspace changes. + * @type {?function(Abstract)} + * @private + */ + this.onchangeWrapper_ = null; + /** * A count of statement inputs on the block. * @type {number} diff --git a/core/block_svg.js b/core/block_svg.js index 54dbdbefd..5fd46d8a7 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -209,6 +209,12 @@ const BlockSvg = function(workspace, prototypeName, opt_id) { */ this.renderIsInProgress_ = false; + /** + * Whether mousedown events have been bound yet. + * @type {boolean} + * @private + */ + this.eventsInit_ = false; /** @type {!WorkspaceSvg} */ this.workspace = workspace; diff --git a/core/comment.js b/core/comment.js index 8dc56bdb8..30f9aac36 100644 --- a/core/comment.js +++ b/core/comment.js @@ -98,6 +98,28 @@ const Comment = function(block) { */ this.onInputWrapper_ = null; + /** + * The SVG element that contains the text edit area, or null if not created. + * @type {?SVGForeignObjectElement} + * @private + */ + this.foreignObject_ = null; + + /** + * The editable text area, or null if not created. + * @type {?Element} + * @private + */ + this.textarea_ = null; + + /** + * The top-level node of the comment text, or null if not created. + * @type {?SVGTextElement} + * @private + */ + this.paragraphElement_ = null; + + this.createIcon(); }; object.inherits(Comment, Icon); diff --git a/core/icon.js b/core/icon.js index aa7195749..3f81e9795 100644 --- a/core/icon.js +++ b/core/icon.js @@ -47,33 +47,34 @@ const Icon = function(block) { * @type {?SVGGElement} */ this.iconGroup_ = null; + + /** + * Whether this icon gets hidden when the block is collapsed. + * @type {boolean} + */ + this.collapseHidden = true; + + /** + * Height and width of icons. + * @const + */ + this.SIZE = 17; + + /** + * Bubble UI (if visible). + * @type {?Bubble} + * @protected + */ + this.bubble_ = null; + + /** + * Absolute coordinate of icon's center. + * @type {?Coordinate} + * @protected + */ + this.iconXY_ = null; }; -/** - * Does this icon get hidden when the block is collapsed. - */ -Icon.prototype.collapseHidden = true; - -/** - * Height and width of icons. - * @const - */ -Icon.prototype.SIZE = 17; - -/** - * Bubble UI (if visible). - * @type {?Bubble} - * @protected - */ -Icon.prototype.bubble_ = null; - -/** - * Absolute coordinate of icon's center. - * @type {?Coordinate} - * @protected - */ -Icon.prototype.iconXY_ = null; - /** * Create the icon on the block. */ @@ -197,7 +198,7 @@ Icon.prototype.getIconLocation = function() { */ // TODO (#2562): Remove getCorrectedSize. Icon.prototype.getCorrectedSize = function() { - return new Size(Icon.prototype.SIZE, Icon.prototype.SIZE - 2); + return new Size(this.SIZE, this.SIZE - 2); }; /** diff --git a/core/mutator.js b/core/mutator.js index bbadd41ea..d1c2ba07d 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -78,6 +78,30 @@ const Mutator = function(quarkNames) { * @private */ this.workspaceHeight_ = 0; + + /** + * The SVG element that is the parent of the mutator workspace, or null if + * not created. + * @type {?SVGSVGElement} + * @private + */ + this.svgDialog_ = null; + + /** + * The root block of the mutator workspace, created by decomposing the source + * block. + * @type {?BlockSvg} + * @private + */ + this.rootBlock_ = null; + + /** + * Function registered on the main workspace to update the mutator contents + * when the main workspace changes. + * @type {?Function} + * @private + */ + this.sourceListener_ = null; }; object.inherits(Mutator, Icon); @@ -341,12 +365,12 @@ Mutator.prototype.setVisible = function(visible) { this.rootBlock_.moveBy(x, margin); // Save the initial connections, then listen for further changes. if (this.block_.saveConnections) { - const thisMutator = this; + const thisRootBlock = this.rootBlock_; const mutatorBlock = /** @type {{saveConnections: function(!Block)}} */ (this.block_); mutatorBlock.saveConnections(this.rootBlock_); this.sourceListener_ = function() { - mutatorBlock.saveConnections(thisMutator.rootBlock_); + mutatorBlock.saveConnections(thisRootBlock); }; this.block_.workspace.addChangeListener(this.sourceListener_); } diff --git a/core/warning.js b/core/warning.js index e34e3258f..1b273bd92 100644 --- a/core/warning.js +++ b/core/warning.js @@ -44,6 +44,13 @@ const Warning = function(block) { // The text_ object can contain multiple warnings. this.text_ = Object.create(null); + /** + * The top-level node of the warning text, or null if not created. + * @type {?SVGTextElement} + * @private + */ + this.paragraphElement_ = null; + /** * Does this icon get hidden when the block is collapsed? * @type {boolean}