[feature] pre select group when adding link from empty group area

This commit is contained in:
zombieFox 2019-11-21 14:58:28 +00:00
parent 749859eb00
commit c0247e26ed

View File

@ -1086,7 +1086,7 @@ var link = (function() {
group.querySelector(".group-body").appendChild(render.item.link()); group.querySelector(".group-body").appendChild(render.item.link());
}); });
} else { } else {
group.querySelector(".group-body").appendChild(render.empty.item()); group.querySelector(".group-body").appendChild(render.empty.item(stagedGroup.position.destination));
}; };
linkSection.appendChild(group); linkSection.appendChild(group);
stagedGroup.reset(); stagedGroup.reset();
@ -1140,7 +1140,7 @@ var link = (function() {
}, false); }, false);
return group; return group;
}, },
item: function() { item: function(groupIndex) {
var linkEmpty = helper.node("div|class:link-empty link-item"); var linkEmpty = helper.node("div|class:link-empty link-item");
var paraWrap = helper.node("div|class:p-wrap"); var paraWrap = helper.node("div|class:p-wrap");
var para = helper.node("p:Empty Group|class:pb-0"); var para = helper.node("p:Empty Group|class:pb-0");
@ -1152,6 +1152,7 @@ var link = (function() {
linkEmpty.appendChild(buttonWrap); linkEmpty.appendChild(buttonWrap);
addButton.addEventListener("click", function(event) { addButton.addEventListener("click", function(event) {
link.add.item.open(); link.add.item.open();
link.add.item.selectGroup(groupIndex);
}, false); }, false);
return linkEmpty; return linkEmpty;
}, },
@ -1369,6 +1370,10 @@ var link = (function() {
stagedLink.reset(); stagedLink.reset();
modal.close(); modal.close();
pagelock.unlock(); pagelock.unlock();
},
selectGroup: function(groupIndex) {
stagedLink.position.destination.group = groupIndex;
helper.e(".link-form-select-group").selectedIndex = stagedLink.position.destination.group;
} }
}, },
group: { group: {
@ -1611,6 +1616,9 @@ var link = (function() {
}, },
close: function() { close: function() {
render.add.item.close(); render.add.item.close();
},
selectGroup: function(groupIndex) {
render.add.item.selectGroup(groupIndex);
} }
}, },
group: { group: {