Closed nbradbury closed 1 year ago
This issue is not limited to TIRAMISU.
It happens when you "Select All" and the editor just contains empty spans. Spans that are started but do not actually contain any text/content.
Another way to reproduce the crash is to start the example app with a blank editor (no EXAMPLE text)
The reason it is reproducible from the example app when you clear the Example text may be because there are a number of empty spans that are left behind after trying to clear the text. In particular many AztecVisualLinebreak spans left behind which is a separate issue.
My guess is that the fix for this may be in handling onTextContextMenuItem and Aztec may need to implement its own selectAllText similar to how it custom handles cut/copy/paste. This may also fix the issue of spans being left behind when you select all of the EXAMPLE text and delete it.
This issue is not limited to TIRAMISU.
@cameocoder Thanks for the clarification! I've removed the version check in 690ae78. I'm not well-versed with this codebase, so I'll wait for someone on the team to chime in about other solutions.
While the fix prevents the crash, if you start typing after selecting empty span, the app will hang :) Ideally we do not want to show the context menu when there is only empty span in editor, but I'm not sure we can do it on the library level.
As @cameocoder suggested, we can a add a bit of logic to onTextContextMenuItem
to deal with it. I think not selecting anything when there is only a block span in editor is a valid option.
Something like this should handle it (have not tested it extensively):
android.R.id.selectAll -> {
return if (text.toString() == Constants.END_OF_BUFFER_MARKER.toString()) {
deleteInlineStyleFromTheBeginning()
return true
} else {
super.onTextContextMenuItem(id)
}
}
@khaykov Thanks for the assist! I made the changes you suggested.
Fixes #880
We have 37 Sentry users experiencing the "IllegalArgumentException: Center point is not inside any of the rectangles" crash in Day One, all of which are on Android 13 (Tiramisu). This appears to be a platform issue rather than a problem with Aztec itself.
Update: It turns out the crash isn't limited to Android 13.
This PR resolves the problem by detecting and ignoring that crash on Android 13. I'm not well-versed with the Aztec codebase, so if there's a better way to resolve this please let me know.
To test:
In trunk, clear the example app's editor
Long press in the empty editor
Choose "Select all"
Boom!
Then pull this branch and observe the problem no longer occurs
[x] If there are new strings that have to be translated, I have added them to the client's
strings.xml
as a part of the integration PR.