Move focus into first node on group creation, don't remove last node in list

This commit is contained in:
Ian Gulliver
2019-06-20 23:22:56 +00:00
parent 3b51c59c7c
commit c223945147

View File

@@ -23,6 +23,14 @@ class List {
this.container_ = container;
}
getEntries() {
let ret = [];
for (let elem of this.container_.children) {
ret.push(elem.xArchObj);
}
return ret;
}
getSelected() {
let iter = document.activeElement;
while (iter) {
@@ -366,10 +374,15 @@ class Node extends EditorEntryBase {
}
onInputBlur() {
if (this.input_.value.length == 0) {
if (this.input_.value.length == 0 && (this.elem_.previousElementSibling ||
this.elem_.nextElementSibling)) {
this.remove();
}
}
getValue() {
return this.input_.value;
}
}
class Group extends EditorEntryBase {
@@ -404,6 +417,12 @@ class Group extends EditorEntryBase {
e.stopPropagation();
e.preventDefault();
this.stopEdit();
{
let nodes = this.nodes_.getEntries();
if (nodes.length == 1 && nodes[0].getValue() == '') {
nodes[0].startEdit();
}
}
break;
case 'ArrowUp':