Add undo/redo keys
This commit is contained in:
12
Editor.js
12
Editor.js
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user