[Bug] replaceText has the possibility of throwing Bad state: no element
#767
Labels
bug
Something isn't working
Bad state: no element
#767
Bug Description
The transaction of
replaceText
does not check the length of the Delta before calling.first
.How to Reproduce
Immediately after inserting a TextDelta with no attribute, call replaceText.
Eg.
Expected Behavior
Change the code in
replaceText
:To add a required check and make sure the logic is correct.
Specifically the call to
.first
ondelta.slice(max(index - 1, 0), index)
is what might fail.Operating System
AppFlowy Editor Version(s)
main
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: