mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Clear all active desc ids when the 'Erase Workspace' button is pressed.
This commit is contained in:
@@ -90,6 +90,7 @@ blocklyApp.SidebarComponent = ng.core.Component({
|
||||
},
|
||||
clearWorkspace: function() {
|
||||
blocklyApp.workspace.clear();
|
||||
this.treeService.clearAllActiveDescs();
|
||||
// The timeout is needed in order to give the blocks time to be cleared
|
||||
// from the workspace, and for the 'workspace is empty' button to show up.
|
||||
setTimeout(function() {
|
||||
|
||||
@@ -214,6 +214,16 @@ blocklyApp.TreeService = ng.core.Class({
|
||||
' is invalid.');
|
||||
}
|
||||
},
|
||||
clearAllActiveDescs: function() {
|
||||
for (var treeId in this.activeDescendantIds_) {
|
||||
var activeDesc = document.getElementById(this.getActiveDescId(treeId));
|
||||
if (activeDesc) {
|
||||
activeDesc.classList.remove('blocklyActiveDescendant');
|
||||
}
|
||||
}
|
||||
|
||||
this.activeDescendantIds_ = {};
|
||||
},
|
||||
|
||||
isTreeRoot_: function(element) {
|
||||
return element.classList.contains('blocklyTree');
|
||||
|
||||
Reference in New Issue
Block a user