Fix redo keyboard shortcut on macOS
I added the correct macOS shortcut for redo which is Cmd+Shift+Z. I had to reorder the if statement so redo is checked first, otherwise it would detect the undo first and never check that I was actually trying to redo. Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
parent
744826db48
commit
d3367834d0
1 changed files with 11 additions and 9 deletions
|
@ -370,6 +370,17 @@ export default class BasicMessageEditor extends React.Component {
|
||||||
} else if (modKey && event.key === Key.GREATER_THAN) {
|
} else if (modKey && event.key === Key.GREATER_THAN) {
|
||||||
this._onFormatAction("quote");
|
this._onFormatAction("quote");
|
||||||
handled = true;
|
handled = true;
|
||||||
|
// redo
|
||||||
|
} else if ((modKey && event.key === Key.Y) ||
|
||||||
|
(IS_MAC && event.shiftKey && event.key === Key.Z)) {
|
||||||
|
debugger;
|
||||||
|
if (this.historyManager.canRedo()) {
|
||||||
|
const {parts, caret} = this.historyManager.redo();
|
||||||
|
// pass matching inputType so historyManager doesn't push echo
|
||||||
|
// when invoked from rerender callback.
|
||||||
|
model.reset(parts, caret, "historyRedo");
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
// undo
|
// undo
|
||||||
} else if (modKey && event.key === Key.Z) {
|
} else if (modKey && event.key === Key.Z) {
|
||||||
if (this.historyManager.canUndo()) {
|
if (this.historyManager.canUndo()) {
|
||||||
|
@ -379,15 +390,6 @@ export default class BasicMessageEditor extends React.Component {
|
||||||
model.reset(parts, caret, "historyUndo");
|
model.reset(parts, caret, "historyUndo");
|
||||||
}
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
// redo
|
|
||||||
} else if (modKey && event.key === Key.Y) {
|
|
||||||
if (this.historyManager.canRedo()) {
|
|
||||||
const {parts, caret} = this.historyManager.redo();
|
|
||||||
// pass matching inputType so historyManager doesn't push echo
|
|
||||||
// when invoked from rerender callback.
|
|
||||||
model.reset(parts, caret, "historyRedo");
|
|
||||||
}
|
|
||||||
handled = true;
|
|
||||||
// insert newline on Shift+Enter
|
// insert newline on Shift+Enter
|
||||||
} else if (event.key === Key.ENTER && (event.shiftKey || (IS_MAC && event.altKey))) {
|
} else if (event.key === Key.ENTER && (event.shiftKey || (IS_MAC && event.altKey))) {
|
||||||
this._insertText("\n");
|
this._insertText("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue