mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Remove unnecessary code
This somehow doesn't seem to be neccessary anymore, I don't really know why but everything seems to work without it Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
09ffad96ff
commit
ccaa69b25b
1 changed files with 0 additions and 24 deletions
|
@ -541,7 +541,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
handled = true;
|
||||
} else if (event.key === Key.BACKSPACE || event.key === Key.DELETE) {
|
||||
this.formatBarRef.current.hide();
|
||||
handled = this.fakeDeletion(event.key === Key.BACKSPACE);
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
|
@ -550,29 +549,6 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Because pills have contentEditable="false" there is no event emitted when
|
||||
* the user tries to delete them. Therefore we need to fake what would
|
||||
* normally happen
|
||||
* @param direction in which to delete
|
||||
* @returns handled
|
||||
*/
|
||||
private fakeDeletion(backward: boolean): boolean {
|
||||
const selection = document.getSelection();
|
||||
// Use the default handling for ranges
|
||||
if (selection.type === "Range") return false;
|
||||
|
||||
this.modifiedFlag = true;
|
||||
const { caret, text } = getCaretOffsetAndText(this.editorRef.current, selection);
|
||||
|
||||
// Do the deletion itself
|
||||
if (backward) caret.offset--;
|
||||
const newText = text.slice(0, caret.offset) + text.slice(caret.offset + 1);
|
||||
|
||||
this.props.model.update(newText, backward ? "deleteContentBackward" : "deleteContentForward", caret);
|
||||
return true;
|
||||
}
|
||||
|
||||
private async tabCompleteName(): Promise<void> {
|
||||
try {
|
||||
await new Promise<void>(resolve => this.setState({ showVisualBell: false }, resolve));
|
||||
|
|
Loading…
Reference in a new issue