Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c6085a1

Browse files
authored
Merge pull request #6603 from SimonBrandner/fix/remove-unnecessary-code
2 parents 09ffad9 + ccaa69b commit c6085a1

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/components/views/rooms/BasicMessageComposer.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
541541
handled = true;
542542
} else if (event.key === Key.BACKSPACE || event.key === Key.DELETE) {
543543
this.formatBarRef.current.hide();
544-
handled = this.fakeDeletion(event.key === Key.BACKSPACE);
545544
}
546545

547546
if (handled) {
@@ -550,29 +549,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
550549
}
551550
};
552551

553-
/**
554-
* Because pills have contentEditable="false" there is no event emitted when
555-
* the user tries to delete them. Therefore we need to fake what would
556-
* normally happen
557-
* @param direction in which to delete
558-
* @returns handled
559-
*/
560-
private fakeDeletion(backward: boolean): boolean {
561-
const selection = document.getSelection();
562-
// Use the default handling for ranges
563-
if (selection.type === "Range") return false;
564-
565-
this.modifiedFlag = true;
566-
const { caret, text } = getCaretOffsetAndText(this.editorRef.current, selection);
567-
568-
// Do the deletion itself
569-
if (backward) caret.offset--;
570-
const newText = text.slice(0, caret.offset) + text.slice(caret.offset + 1);
571-
572-
this.props.model.update(newText, backward ? "deleteContentBackward" : "deleteContentForward", caret);
573-
return true;
574-
}
575-
576552
private async tabCompleteName(): Promise<void> {
577553
try {
578554
await new Promise<void>(resolve => this.setState({ showVisualBell: false }, resolve));

0 commit comments

Comments
 (0)