mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Use dataset instead of ID.
This commit is contained in:
@@ -101,7 +101,7 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) {
|
||||
workspace, prototypeName, opt_id);
|
||||
|
||||
// Expose this block's ID on its top-level SVG group.
|
||||
this.svgGroup_.id = 'block' + this.id;
|
||||
this.svgGroup_.dataset.blockId = this.id;
|
||||
};
|
||||
goog.inherits(Blockly.BlockSvg, Blockly.Block);
|
||||
|
||||
|
||||
@@ -284,10 +284,10 @@ Blockly.Bubble.prototype.getSvgRoot = function() {
|
||||
|
||||
/**
|
||||
* Expose the block's ID on the bubble's top-level SVG group.
|
||||
* @param {string} id Bubble type and ID of block.
|
||||
* @param {string} id ID of block.
|
||||
*/
|
||||
Blockly.Bubble.prototype.setSvgId = function(id) {
|
||||
this.bubbleGroup_.id = id;
|
||||
this.bubbleGroup_.dataset.id = id;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -201,7 +201,7 @@ Blockly.Comment.prototype.setVisible = function(visible) {
|
||||
this.createEditor_(), this.block_.svgPath_,
|
||||
this.iconXY_, this.width_, this.height_);
|
||||
// Expose this comment's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId('comment' + this.block_.id);
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this));
|
||||
this.updateColour();
|
||||
} else {
|
||||
|
||||
@@ -250,7 +250,7 @@ Blockly.Mutator.prototype.setVisible = function(visible) {
|
||||
/** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace),
|
||||
this.createEditor_(), this.block_.svgPath_, this.iconXY_, null, null);
|
||||
// Expose this mutator's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId('mutator' + this.block_.id);
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
var tree = this.workspace_.options.languageTree;
|
||||
if (tree) {
|
||||
this.workspace_.flyout_.init(this.workspace_);
|
||||
|
||||
@@ -125,7 +125,7 @@ Blockly.Warning.prototype.setVisible = function(visible) {
|
||||
/** @type {!Blockly.WorkspaceSvg} */ (this.block_.workspace),
|
||||
paragraph, this.block_.svgPath_, this.iconXY_, null, null);
|
||||
// Expose this warning's block's ID on its top-level SVG group.
|
||||
this.bubble_.setSvgId('warning' + this.block_.id);
|
||||
this.bubble_.setSvgId(this.block_.id);
|
||||
if (this.block_.RTL) {
|
||||
// Right-align the paragraph.
|
||||
// This cannot be done until the bubble is rendered on screen.
|
||||
|
||||
Reference in New Issue
Block a user