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

Commit 3a1a488

Browse files
authored
Merge pull request #6844 from SimonBrandner/fix/firefox-revert
Revert Firefox composer deletion hacks
2 parents 5b8279d + bce4d44 commit 3a1a488

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

src/components/views/rooms/BasicMessageComposer.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
499499
handled = true;
500500
} else if (event.key === Key.BACKSPACE || event.key === Key.DELETE) {
501501
this.formatBarRef.current.hide();
502-
if (!event.ctrlKey && !event.metaKey) {
503-
handled = this.fakeDeletion(event.key === Key.BACKSPACE);
504-
}
505502
}
506503

507504
if (handled) {
@@ -567,29 +564,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
567564
}
568565
};
569566

570-
/**
571-
* TODO: Remove when Debian moves to newer version of Firefox
572-
* On Firefox 78 no event emitted when the user tries to delete pills.
573-
* Therefore we need to fake what would normally happen
574-
* @param direction in which to delete
575-
* @returns handled
576-
*/
577-
private fakeDeletion(backward: boolean): boolean {
578-
const selection = document.getSelection();
579-
// Use the default handling for ranges
580-
if (selection.type === "Range") return false;
581-
582-
this.modifiedFlag = true;
583-
const { caret, text } = getCaretOffsetAndText(this.editorRef.current, selection);
584-
585-
// Do the deletion itself
586-
if (backward) caret.offset--;
587-
const newText = text.slice(0, caret.offset) + text.slice(caret.offset + 1);
588-
589-
this.props.model.update(newText, backward ? "deleteContentBackward" : "deleteContentForward", caret);
590-
return true;
591-
}
592-
593567
private async tabCompleteName(): Promise<void> {
594568
try {
595569
await new Promise<void>(resolve => this.setState({ showVisualBell: false }, resolve));

0 commit comments

Comments
 (0)