Closed planarvoid closed 1 year ago
@planarvoid At this point I don't remember all the use cases for the complicated method, but I think it's related to line breaks (and maybe something else.
On the left is this branch, on the right is trunk. As you can see the cursor is positioned below the pre block on a new line. In trunk it's correctly detecting that it's not a pre (icon is not highlighted in toolbar) and in this branch it detects pre incorrectly (icon is highlighted).
Thanks for the review @khaykov . I've returned the original method but it was broken as well so I've fixed it. The previous The previous solution didn't support something like this:
<p>First line</p>
<pre>Pre line 1<br></pre>
<p></p>
<p>Last line</p>
If you had an empty line at the end of PRE block, the PRE
button wasn't highlighted when you clicked into it. I think it should be fixed now.
I've also uncommented and fixed all the preformat tests.
Fix
The
containsPreformat
method doesn't work well when the preformat doesn't contain any code. In this PR I'm simplifying it so that it works in all cases. I don't know why it was originally so complicated. I think the original behaviour doesn't have any benefits.Test
Enable preformat action by adding it to toolbar actions
to make it easier set the
EXAMPLE
in theMainActivity
to something like this:preformat
disappears and is not duplicatedReview
@khaykov
Make sure strings will be translated:
strings.xml
as a part of the integration PR.