Proper history tracking

This commit is contained in:
Ian Gulliver
2019-07-11 22:30:53 +00:00
parent d906e6a933
commit 0485580b89
4 changed files with 93 additions and 10 deletions

View File

@@ -9,8 +9,11 @@ class EditorLabel extends EditorEntryBase {
this.input_.type = 'text';
this.input_.placeholder = 'label';
this.listen(this.input_, 'keydown', (e) => this.onInputKeyDown(e));
this.listen(this.input_, 'input', (e) => this.onInput());
this.listen(this.input_, 'input', (e) => this.onInput(e));
this.listen(this.input_, 'blur', (e) => this.onBlur(e));
this.elem_.appendChild(this.input_);
this.lastSnapshotLabel_ = null;
}
afterDomAdd() {
@@ -30,6 +33,7 @@ class EditorLabel extends EditorEntryBase {
setLabel(label) {
this.input_.value = label;
this.lastSnapshotLabel_ = label;
this.onInput();
}
@@ -38,7 +42,14 @@ class EditorLabel extends EditorEntryBase {
}
onInput() {
this.input_.setAttribute('data-arch-refresh', '');
this.elem_.setAttribute('data-arch-refresh', '');
}
onBlur() {
if (this.getLabel() != this.lastSnapshotLabel_) {
this.lastSnapshotLabel_ = this.getLabel();
this.elem_.setAttribute('data-arch-snapshot', '');
}
}
onInputKeyDown(e) {