Skip to content

Commit fa43864

Browse files
committed
Fix the history when copy/pasting
1 parent 9b22a37 commit fa43864

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ class AztecText : AppCompatAutoCompleteTextView, TextWatcher, UnknownHtmlSpan.On
10151015
val clip = clipboard.primaryClip
10161016

10171017
if (clip != null) {
1018+
history.beforeTextChanged(toFormattedHtml())
1019+
10181020
disableTextChangedListener()
10191021

10201022
if (min == 0 && max == text.length) {
@@ -1044,7 +1046,6 @@ class AztecText : AppCompatAutoCompleteTextView, TextWatcher, UnknownHtmlSpan.On
10441046
val oldHtml = toPlainHtml().replace("<aztec_cursor>", "")
10451047
val newHtml = oldHtml.replace(Constants.REPLACEMENT_MARKER_STRING, textToPaste + "<" + AztecCursorSpan.AZTEC_CURSOR_TAG + ">")
10461048

1047-
history.beforeTextChanged(toFormattedHtml())
10481049
fromHtml(newHtml)
10491050
history.handleHistory(this@AztecText)
10501051

0 commit comments

Comments
 (0)