diff --git a/CHANGELOG.md b/CHANGELOG.md index f0906a865..afe8702e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ # Changelog +## [v1.3.25](https://github.com/wordpress-mobile/AztecEditor-Android/releases/tag/v1.3.25) +### Changed +- Remove some unneeded logging #806 +### Fixed +- Don't bail when ZWJ cleanup found end-of-text marker #807 +- Prevent execution of InputFilter for new lines #809 + ## [v1.3.24](https://github.com/wordpress-mobile/AztecEditor-Android/releases/tag/v1.3.24) ### Changed - Improvement to how clickable URL spans are handled #793 diff --git a/README.md b/README.md index 4d6bd6fc1..29985cf9c 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ repositories { ``` ```gradle dependencies { - api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:v1.3.24') + api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:v1.3.25') } ``` diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt b/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt index 8c920edfb..24de93da1 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt @@ -335,8 +335,9 @@ class AztecParser @JvmOverloads constructor(val plugins: List = li do { lastIndex = text.lastIndexOf(Constants.ZWJ_CHAR, lastIndex) if (lastIndex == text.length - 1) { - // ZWJ at the end of text will serve as end-of-text marker so, let it be and finish. - return + // ZWJ at the end of text will serve as end-of-text marker so, let it be and continue cleaning up ZWJs + lastIndex-- + continue } if (lastIndex > -1) { diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt b/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt index 2b657a45f..eb2fd0c3a 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt @@ -462,8 +462,11 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown // https://android-review.googlesource.com/c/platform/frameworks/base/+/634929 val dynamicLayoutCrashPreventer = InputFilter { source, start, end, dest, dstart, dend -> var temp : CharSequence? = null - if (!bypassCrashPreventerInputFilter && dstart == dend && dest.length > dend+1) { + if (!bypassCrashPreventerInputFilter + && dstart == dend && dest.length > dend+1 + && source != Constants.NEWLINE_STRING) { // dstart == dend means this is an insertion + // avoid handling anything if it's a newline // if there are any images right after the destination position, hack the text val spans = dest.getSpans(dstart, dend+1, AztecImageSpan::class.java) if (spans.isNotEmpty()) { diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/UserOperationEvent.kt b/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/UserOperationEvent.kt index b525ce2c0..235f38220 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/UserOperationEvent.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/UserOperationEvent.kt @@ -1,6 +1,5 @@ package org.wordpress.aztec.watchers.event.sequence -import org.wordpress.android.util.AppLog import org.wordpress.aztec.spans.AztecCodeSpan import org.wordpress.aztec.spans.AztecHeadingSpan import org.wordpress.aztec.spans.AztecListItemSpan @@ -78,9 +77,6 @@ abstract class UserOperationEvent(var sequence: EventSequence insideHeading = false } - AppLog.d(AppLog.T.EDITOR, "SEQUENCE OBSERVED COMPLETELY, IS IT WITHIN BLOCK?: " + - (isInsideList || insideHeading || isInsidePre || isInsideCode)) - return isInsideList || insideHeading || isInsidePre || isInsideCode } diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/known/space/steps/TextWatcherEventInsertTextDelAfter.kt b/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/known/space/steps/TextWatcherEventInsertTextDelAfter.kt index ede64e6dd..6bf4f759e 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/known/space/steps/TextWatcherEventInsertTextDelAfter.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/watchers/event/sequence/known/space/steps/TextWatcherEventInsertTextDelAfter.kt @@ -1,6 +1,5 @@ package org.wordpress.aztec.watchers.event.sequence.known.space.steps -import org.wordpress.android.util.AppLog import org.wordpress.aztec.watchers.EndOfBufferMarkerAdder import org.wordpress.aztec.watchers.event.text.AfterTextChangedEventData import org.wordpress.aztec.watchers.event.text.BeforeTextChangedEventData @@ -18,17 +17,14 @@ class TextWatcherEventInsertTextDelAfter(beforeEventData: BeforeTextChangedEvent private fun testBeforeTextChangedEventData(data: BeforeTextChangedEventData): Boolean { beforeText = data.textBefore - AppLog.d(AppLog.T.EDITOR, "INSERTSPECIAL testBeforeTextChangedEventData: " + (data.count == 0 && data.after > 0)) return data.count == 0 && data.after > 0 } private fun testOnTextChangedEventData(data: OnTextChangedEventData): Boolean { - AppLog.d(AppLog.T.EDITOR, "INSERTSPECIAL testOnTextChangedEventData: " + (data.start >= 0 && data.count > 0 && data.textOn!!.length > 0)) return data.start >= 0 && data.count > 0 && data.textOn!!.length > 0 } private fun testAfterTextChangedEventData(data: AfterTextChangedEventData): Boolean { - AppLog.d(AppLog.T.EDITOR, "INSERTSPECIAL testAfterTextChangedEventData: " + (EndOfBufferMarkerAdder.safeLength(beforeText!!) == EndOfBufferMarkerAdder.safeLength(data.textAfter!!))) return EndOfBufferMarkerAdder.safeLength(beforeText!!) == EndOfBufferMarkerAdder.safeLength(data.textAfter!!) }