mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 08:35:16 +08:00
Pressing backspace at the top of the composer should not delete down #578
This commit is contained in:
parent
65ddf18416
commit
dc558c889e
1 changed files with 15 additions and 0 deletions
|
@ -332,6 +332,21 @@ export default [
|
|||
onlyIn: [BLOCK_CONFIG.code.type],
|
||||
}),
|
||||
|
||||
// Pressing backspace when you're at the top of the document should not delete down
|
||||
{
|
||||
onKeyDown: function onKeyDown(event, change) {
|
||||
if (event.key !== 'Backspace' || event.shiftKey || event.metaKey || event.optionKey) {
|
||||
return;
|
||||
}
|
||||
const { focusText, focusOffset, document } = change.value;
|
||||
const firstText = document.getFirstText();
|
||||
if (focusOffset === 0 && focusText && firstText && firstText.key === focusText.key) {
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// Return breaks you out of blockquotes completely
|
||||
{
|
||||
onKeyDown: function onKeyDown(event, change) {
|
||||
|
|
Loading…
Reference in a new issue