Simplifie code

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-06-21 17:26:06 +02:00
parent 3e97847e7d
commit d7b10e2ff4
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -457,12 +457,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
// trim the range as we want it to exclude leading/trailing spaces
selectionRange.trim();
if (SURROUND_WITH_CHARACTERS.includes(event.key)) {
this.historyManager.ensureLastChangesPushed(this.props.model);
this.modifiedFlag = true;
toggleInlineFormat(selectionRange, event.key);
handled = true;
} else if ([...SURROUND_WITH_DOUBLE_CHARACTERS.keys()].includes(event.key)) {
if ([...SURROUND_WITH_DOUBLE_CHARACTERS.keys(), ...SURROUND_WITH_CHARACTERS].includes(event.key)) {
this.historyManager.ensureLastChangesPushed(this.props.model);
this.modifiedFlag = true;
toggleInlineFormat(selectionRange, event.key, SURROUND_WITH_DOUBLE_CHARACTERS.get(event.key));