Add undo/redo keys

This commit is contained in:
Ian Gulliver
2019-07-11 22:43:18 +00:00
parent 498d1cbb1e
commit 7274886d76
4 changed files with 24 additions and 2 deletions

View File

@@ -194,6 +194,18 @@ class Editor extends List {
}
return;
case 'u':
history.back();
e.stopPropagation();
e.preventDefault();
return;
case 'U':
history.forward();
e.stopPropagation();
e.preventDefault();
return;
case '?':
if (this.addHelpAfter()) {
e.stopPropagation();

View File

@@ -53,6 +53,16 @@ class EditorHelp extends EditorEntryBase {
this.addLine();
this.addKey('f');
this.addText('Flip link ');
this.addLine();
this.addKey('u');
this.addText('Undo ');
this.addLine();
this.addKey('⇧');
this.addText('+');
this.addKey('u');
this.addText('Redo ');
}
addLine() {

View File

@@ -13,7 +13,7 @@ class EditorLabel extends EditorEntryBase {
this.listen(this.input_, 'blur', (e) => this.onBlur(e));
this.elem_.appendChild(this.input_);
this.lastSnapshotLabel_ = null;
this.lastSnapshotLabel_ = '';
}
afterDomAdd() {

View File

@@ -12,7 +12,7 @@ class EditorNode extends EditorEntryBase {
this.listen(this.input_, 'blur', (e) => this.onBlur(e));
this.elem_.appendChild(this.input_);
this.lastSnapshotLabel_ = null;
this.lastSnapshotLabel_ = '';
if (label) {
this.setLabel(label);