Add back setters for theme (#3674)

This commit is contained in:
alschmiedt
2020-02-07 09:20:21 -08:00
committed by GitHub
parent d3f8278c39
commit e1bb1d667e

View File

@@ -51,12 +51,14 @@ Blockly.Theme = function(name, blockStyles, categoryStyles,
/**
* The block styles map.
* @type {!Object.<string, !Blockly.Theme.BlockStyle>}
* @package
*/
this.blockStyles = blockStyles;
/**
* The category styles map.
* @type {!Object.<string, Blockly.Theme.CategoryStyle>}
* @package
*/
this.categoryStyles = categoryStyles;
@@ -87,6 +89,25 @@ Blockly.Theme.BlockStyle;
*/
Blockly.Theme.CategoryStyle;
/**
* Overrides or adds a style to the blockStyles map.
* @param {string} blockStyleName The name of the block style.
* @param {Blockly.Theme.BlockStyle} blockStyle The block style.
*/
Blockly.Theme.prototype.setBlockStyle = function(blockStyleName, blockStyle) {
this.blockStyles[blockStyleName] = blockStyle;
};
/**
* Overrides or adds a style to the categoryStyles map.
* @param {string} categoryStyleName The name of the category style.
* @param {Blockly.Theme.CategoryStyle} categoryStyle The category style.
*/
Blockly.Theme.prototype.setCategoryStyle = function(categoryStyleName,
categoryStyle) {
this.categoryStyles[categoryStyleName] = categoryStyle;
};
/**
* Gets the style for a given Blockly UI component. If the style value is a
* string, we attempt to find the value of any named references.