Add ctrl-enter to edit a node and all references
This commit is contained in:
15
Editor.js
15
Editor.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user