Skip to content

Commit

Permalink
Merge pull request #1038 from wordpress-mobile/fix/undo-when-deleting…
Browse files Browse the repository at this point in the history
…-placeholder

Make sure to save remove action to history
  • Loading branch information
khaykov authored Mar 17, 2023
2 parents 7a5afb8 + a1d52e7 commit 9cd1615
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
}

fun removeMedia(attributePredicate: AttributePredicate) {
history.beforeTextChanged(this@AztecText)
text.getSpans(0, text.length, AztecMediaSpan::class.java)
.filter {
attributePredicate.matches(it.attributes)
Expand Down Expand Up @@ -2252,6 +2253,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
}
mediaSpan.onMediaDeleted()
}
contentChangeWatcher.notifyContentChanged()
}

fun replaceMediaSpan(aztecMediaSpan: AztecMediaSpan, predicate: (Attributes) -> Boolean) {
Expand Down

0 comments on commit 9cd1615

Please sign in to comment.