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:
Sam El-Husseini
2019-09-26 16:52:17 -07:00
committed by GitHub
parent b587ad71c5
commit 870824bc3e
23 changed files with 566 additions and 130 deletions

View File

@@ -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;
};