cancel the edit when pressing escape
This commit is contained in:
parent
ddefeae136
commit
62b8973e72
1 changed files with 4 additions and 2 deletions
|
@ -107,10 +107,12 @@ export default class MessageEditor extends React.Component {
|
||||||
} else if (event.key === "Enter") {
|
} else if (event.key === "Enter") {
|
||||||
this._sendEdit();
|
this._sendEdit();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
} else if (event.key === "Escape") {
|
||||||
|
this._cancelEdit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onCancelClicked = () => {
|
_cancelEdit = () => {
|
||||||
dis.dispatch({action: "edit_event", event: null});
|
dis.dispatch({action: "edit_event", event: null});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +187,7 @@ export default class MessageEditor extends React.Component {
|
||||||
ref={ref => this._editorRef = ref}
|
ref={ref => this._editorRef = ref}
|
||||||
></div>
|
></div>
|
||||||
<div className="mx_MessageEditor_buttons">
|
<div className="mx_MessageEditor_buttons">
|
||||||
<AccessibleButton kind="secondary" onClick={this._onCancelClicked}>{_t("Cancel")}</AccessibleButton>
|
<AccessibleButton kind="secondary" onClick={this._cancelEdit}>{_t("Cancel")}</AccessibleButton>
|
||||||
<AccessibleButton kind="primary" onClick={this._sendEdit}>{_t("Save")}</AccessibleButton>
|
<AccessibleButton kind="primary" onClick={this._sendEdit}>{_t("Save")}</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
|
|
Loading…
Reference in a new issue