The first bug is caused by typing a ` resulting in the model containingwhilst the text view only contains the single space inserted by the user. Deleting that space leaves the model with ` which can't be deleted as the text view is now empty.
Discussed this with @Velin92 and we concluded the simplest fix for now was what this PR does, although it doesn't help when typing a single space for a new item in a list or as the first line in a quote, where you can see the same behaviour with an extra space in the model compared to the text view.
The second bug is caused by writing a multi-line paragraph and then deleting it. It leaves a single empty paragraph within the model (and there are tests in Rust to ensure this is the case). In this instance we can check for a \n character which isn't valid HTML and ignore it.
The first bug is caused by typing a
` resulting in the model containing
whilst the text view only contains the single space inserted by the user. Deleting that space leaves the model with
` which can't be deleted as the text view is now empty.Discussed this with @Velin92 and we concluded the simplest fix for now was what this PR does, although it doesn't help when typing a single space for a new item in a list or as the first line in a quote, where you can see the same behaviour with an extra space in the model compared to the text view.
The second bug is caused by writing a multi-line paragraph and then deleting it. It leaves a single empty paragraph within the model (and there are tests in Rust to ensure this is the case). In this instance we can check for a
\n
character which isn't valid HTML and ignore it.Fixes both issues mentioned in https://github.com/element-hq/element-x-ios/issues/2538