mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Migrate selected from Blockly to Blockly.common (#5489)
* Add getSelected/setSelected to core/common.js * Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected * Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected * Remove Blockly.selected * Use variable instead of calling common.getSelected() multiple times * Add accessor for selected on Blockly * Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
This commit is contained in:
@@ -80,11 +80,21 @@ Object.defineProperty(Blockly, 'mainWorkspace', {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Currently selected block.
|
||||
* @type {?Blockly.ICopyable}
|
||||
*/
|
||||
Blockly.selected = null;
|
||||
// Add a getter and setter pair for Blockly.selected, for legacy reasons.
|
||||
Object.defineProperty(Blockly, 'selected', {
|
||||
get: function() {
|
||||
Blockly.utils.deprecation.warn(
|
||||
'Blockly.selected', 'September 2021', 'September 2022',
|
||||
'Blockly.common.getSelected()');
|
||||
return Blockly.common.getSelected();
|
||||
},
|
||||
set: function(newSelection) {
|
||||
Blockly.utils.deprecation.warn(
|
||||
'Blockly.selected', 'September 2021', 'September 2022',
|
||||
'Blockly.common.setSelected()');
|
||||
Blockly.common.setSelected(newSelection);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the dimensions of the specified SVG image.
|
||||
|
||||
Reference in New Issue
Block a user