From 2563f926dcb6ecf9bb53ffbf740aba664ab37db0 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 31 Dec 2021 16:29:29 +0100 Subject: [PATCH] Prevent update selected styles when text changes (GB mode) Gutenberg already controls the selected styles so we need to prevent Aztec modifying them when text changes. --- aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt b/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt index a06976b11..e948dd760 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt @@ -1048,7 +1048,10 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown } onSelectionChangedListener?.onSelectionChanged(selStart, selEnd) - setSelectedStyles(getAppliedStyles(selStart, selEnd)) + // Gutenberg controls the selected styles so we need to prevent Aztec to modify them + if (!isInGutenbergMode) { + setSelectedStyles(getAppliedStyles(selStart, selEnd)) + } isLeadingStyleRemoved = false }