Skip to content

Commit

Permalink
Update handleBackspaceAndEnter to prevent removing the current styles…
Browse files Browse the repository at this point in the history
… when backspacing if Gutenberg mode is enabled and it's at the start of the EditText
  • Loading branch information
Gerardo committed Mar 13, 2024
1 parent e204002 commit d845fbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,10 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown

var wasStyleRemoved = false
if (event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_DEL) {
if (isInGutenbergMode && (selectionStart == 0 && isTextSelected())) {
return false
}

if (!consumeHistoryEvent) {
history.beforeTextChanged(this@AztecText)
}
Expand Down

0 comments on commit d845fbf

Please sign in to comment.