mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
After marking a spot or copying a block in the workspace, move the active desc to the parent.
This commit is contained in:
@@ -266,6 +266,7 @@ blocklyApp.TreeService = ng.core
|
||||
while (dfsStack.length) {
|
||||
var currentNode = dfsStack.shift();
|
||||
if (currentNode.tagName == 'BUTTON') {
|
||||
this.moveActiveDescToParent(treeId);
|
||||
currentNode.click();
|
||||
break;
|
||||
} else if (currentNode.tagName == 'INPUT') {
|
||||
@@ -307,16 +308,7 @@ blocklyApp.TreeService = ng.core
|
||||
}
|
||||
} else if (e.keyCode == 37) {
|
||||
// Left arrow key. Go up a level, if possible.
|
||||
var nextNode = activeDesc.parentNode;
|
||||
if (this.isButtonOrFieldNode_(activeDesc)) {
|
||||
nextNode = nextNode.parentNode;
|
||||
}
|
||||
while (nextNode && nextNode.tagName != 'LI') {
|
||||
nextNode = nextNode.parentNode;
|
||||
}
|
||||
if (nextNode) {
|
||||
this.setActiveDesc(nextNode.id, treeId);
|
||||
}
|
||||
this.moveActiveDescToParent(treeId);
|
||||
} else if (e.keyCode == 38) {
|
||||
// Up arrow key. Go to the previous sibling, if possible.
|
||||
var prevSibling = this.getPreviousSibling(activeDesc);
|
||||
@@ -342,6 +334,19 @@ blocklyApp.TreeService = ng.core
|
||||
}
|
||||
}
|
||||
},
|
||||
moveActiveDescToParent: function(treeId) {
|
||||
var activeDesc = document.getElementById(this.getActiveDescId(treeId));
|
||||
var nextNode = activeDesc.parentNode;
|
||||
if (this.isButtonOrFieldNode_(activeDesc)) {
|
||||
nextNode = nextNode.parentNode;
|
||||
}
|
||||
while (nextNode && nextNode.tagName != 'LI') {
|
||||
nextNode = nextNode.parentNode;
|
||||
}
|
||||
if (nextNode) {
|
||||
this.setActiveDesc(nextNode.id, treeId);
|
||||
}
|
||||
},
|
||||
getFirstChild: function(element) {
|
||||
if (!element) {
|
||||
return element;
|
||||
|
||||
Reference in New Issue
Block a user