1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-07 10:46:24 +03:00

add shortcuts for formatting

This commit is contained in:
Bruno Windels
2019-09-05 15:07:12 +02:00
parent de787c798c
commit bdcea6f21e

View File

@@ -266,8 +266,20 @@ export default class BasicMessageEditor extends React.Component {
const model = this.props.model;
const modKey = IS_MAC ? event.metaKey : event.ctrlKey;
let handled = false;
// format bold
if (modKey && event.key === "b") {
this._onFormatAction("bold");
handled = true;
// format italics
} else if (modKey && event.key === "i") {
this._onFormatAction("italics");
handled = true;
// format quote
} else if (modKey && event.key === ">") {
this._onFormatAction("quote");
handled = true;
// undo
if (modKey && event.key === "z") {
} else if (modKey && event.key === "z") {
if (this.historyManager.canUndo()) {
const {parts, caret} = this.historyManager.undo(this.props.model);
// pass matching inputType so historyManager doesn't push echo