Add ctrl-enter to edit a node and all references

This commit is contained in:
Ian Gulliver
2019-07-16 17:24:24 +00:00
parent ccf4299d5a
commit a66bee672d
5 changed files with 49 additions and 4 deletions

View File

@@ -18,6 +18,8 @@ class Editor extends List {
// tab flow.
this.container_.tabIndex = 99999;
this.container_.addEventListener('keydown', e => { this.onKeyDown(e); });
this.container_.addEventListener('updateNodesRequest',
e => { this.onUpdateNodesRequest(e); });
this.container_.focus();
}
@@ -162,6 +164,19 @@ class Editor extends List {
}
return null;
}
updateNodes(oldLabel, newLabel) {
let nodes = this.queryEntries('[data-arch-class="EditorNode"]', EditorNode);
for (let node of nodes) {
if (node.getLabel() == oldLabel) {
node.setLabel(newLabel);
}
}
}
onUpdateNodesRequest(e) {
this.updateNodes(e.detail.oldLabel, e.detail.newLabel);
}
onKeyDown(e) {
switch (e.key) {