In the composer, allow the user to delete a selection from the first character forward

This commit is contained in:
Ben Gotow 2019-03-27 01:28:55 -07:00
parent 16ab68d895
commit 74d2b5a65a
2 changed files with 11 additions and 7 deletions

View file

@ -401,9 +401,15 @@ export default [
if (event.key !== 'Backspace' || event.shiftKey || event.metaKey || event.optionKey) {
return;
}
const { focusText, focusOffset, document } = change.value;
const { selection, focusText, focusOffset, document } = change.value;
const firstText = document.getFirstText();
if (focusOffset === 0 && focusText && firstText && firstText.key === focusText.key) {
if (
selection.isCollapsed &&
focusOffset === 0 &&
focusText &&
firstText &&
firstText.key === focusText.key
) {
event.preventDefault();
return true;
}

View file

@ -26,15 +26,13 @@ parts:
source: ./app/dist/mailspring-MAILSPRING_VERSION-amd64.deb
source-type: deb
# Correct path to icon.
after:
- desktop-gtk3
override-build: |
set -ex
snapcraftctl build
prepare: |
sed -i 's|Icon=mailspring|Icon=/usr/share/pixmaps/mailspring\.png|' usr/share/applications/mailspring.desktop
mkdir -p $SNAPCRAFT_PART_INSTALL/share/themes
mkdir -p $SNAPCRAFT_PART_INSTALL/share/icons
mkdir -p $SNAPCRAFT_PART_INSTALL/share/sounds
after:
- desktop-gtk3
stage:
- share/icons
- share/themes