Clean up workspace.component.js. When moving a block from one place to another, move all blocks after it too, and adjust the active descs accordingly.

This commit is contained in:
Sean Lip
2017-01-19 17:12:15 -08:00
parent 1655850d60
commit fceba91c6c
4 changed files with 87 additions and 90 deletions

View File

@@ -32,6 +32,7 @@ blocklyApp.WorkspaceComponent = ng.core.Component({
<div *ngIf="workspace" class="blocklyWorkspace">
<ol #tree *ngFor="#topBlock of workspace.topBlocks_; #groupIndex = index"
[id]="tree.id || getNewTreeId()"
tabindex="0" role="tree" class="blocklyTree blocklyWorkspaceFocusTarget"
[attr.aria-activedescendant]="getActiveDescId(tree.id)"
[attr.aria-labelledby]="workspaceTitle.id"
@@ -70,8 +71,13 @@ blocklyApp.WorkspaceComponent = ng.core.Component({
this.ID_FOR_EMPTY_WORKSPACE_BTN = blocklyApp.ID_FOR_EMPTY_WORKSPACE_BTN;
this.workspace = blocklyApp.workspace;
this.currentTreeId = 0;
}
],
getNewTreeId: function() {
this.currentTreeId++;
return 'blockly-tree-' + this.currentTreeId;
},
getActiveDescId: function(treeId) {
return this.treeService.getActiveDescId(treeId);
},