fix: component id should be on the prototype (#6104)

This commit is contained in:
Rachel Fenichel
2022-04-22 11:22:35 -07:00
committed by GitHub
parent 619ee66b23
commit 172a8ce212
4 changed files with 26 additions and 1 deletions

View File

@@ -49,6 +49,13 @@ class DeleteArea extends DragTarget {
* @protected
*/
this.wouldDelete_ = false;
/**
* The unique id for this component that is used to register with the
* ComponentManager.
* @type {string}
*/
this.id;
}
/**

View File

@@ -33,6 +33,19 @@ const {Rect} = goog.requireType('Blockly.utils.Rect');
* @alias Blockly.DragTarget
*/
class DragTarget {
/**
* Constructor for DragTarget. It exists to add the id property and should not
* be called directly, only by a subclass.
*/
constructor() {
/**
* The unique id for this component that is used to register with the
* ComponentManager.
* @type {string}
*/
this.id;
}
/**
* Handles when a cursor with a block or bubble enters this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being

View File

@@ -63,4 +63,9 @@ IBlockDragger.prototype.endDrag;
*/
IBlockDragger.prototype.getInsertionMarkers;
/**
* Sever all links from this object and do any necessary cleanup.
*/
IBlockDragger.prototype.dispose;
exports.IBlockDragger = IBlockDragger;

View File

@@ -32,6 +32,6 @@ const IComponent = function() {};
* ComponentManager.
* @type {string}
*/
IComponent.id;
IComponent.prototype.id;
exports.IComponent = IComponent;