0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Fix backspace can delete two characters

If we're handling the backspace completely ourselves, must prevent
default to stop the browser also having a go.
This commit is contained in:
Neil Jenkins 2023-02-22 11:27:16 +11:00
parent 137c8f0b17
commit cf30a69b89

View file

@ -94,6 +94,7 @@ const Backspace = (self: Squire, event: KeyboardEvent, range: Range): void => {
text.deleteData(offset - 1, 1);
self.setSelection(range);
self.removeLink();
event.preventDefault();
} else {
// Otherwise, leave to browser but check afterwards whether it has
// left behind an empty inline tag.