mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Workspace theme (#3093)
* Move the theme object so it's on the workspace. * Add support for subscribing UI elements to theme component styles and changes.
This commit is contained in:
@@ -156,6 +156,10 @@ Blockly.FlyoutButton.prototype.createDom = function() {
|
||||
},
|
||||
this.svgGroup_);
|
||||
svgText.textContent = Blockly.utils.replaceMessageReferences(this.text_);
|
||||
if (this.isLabel_) {
|
||||
this.svgText_ = svgText;
|
||||
this.workspace_.getThemeManager().subscribe(this.svgText_, 'flyoutText', 'fill');
|
||||
}
|
||||
|
||||
this.width = Blockly.utils.dom.getTextWidth(svgText);
|
||||
this.height = 20; // Can't compute it :(
|
||||
@@ -235,6 +239,9 @@ Blockly.FlyoutButton.prototype.dispose = function() {
|
||||
Blockly.utils.dom.removeNode(this.svgGroup_);
|
||||
this.svgGroup_ = null;
|
||||
}
|
||||
if (this.svgText_) {
|
||||
this.workspace_.getThemeManager().unsubscribe(this.svgText_);
|
||||
}
|
||||
this.workspace_ = null;
|
||||
this.targetWorkspace_ = null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user