Make nodes selectable from the grid

This commit is contained in:
Ian Gulliver
2019-07-11 05:12:08 +00:00
parent 15ad72dc0a
commit ea5e3cb7e1
15 changed files with 50 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ class EditorEntryBase extends ListenUtils {
this.elem_ = document.createElement('li');
this.elem_.tabIndex = 0;
this.elem_.id = 'entry' + idSource.getId();
this.listen(this.elem_, 'focus', () => this.onElemFocus());
this.listen(this.elem_, 'keydown', (e) => this.onKeyDown(e));
@@ -37,6 +38,10 @@ class EditorEntryBase extends ListenUtils {
return this.elem_;
}
getId() {
return this.elem_.id;
}
onElemFocus() {
this.elem_.scrollIntoView({block: 'nearest'});
}