This PR fixes issue with adding new block spans right next to the existing ones, when exclusiveBlocks is set to true.
To test this PR and the original issue you need to add aztec:exclusiveBlocks="true" to AztecTextlayout.
When exclusiveBlocks is set to true the block are replaced when other block style is applied to them (normal behavior is to allow multiple block style to be applied).
Issue was caused because the range we used to detect spans we should remove included the span on the line before the cursor. I used the range logic from the toolbar highlight code, which I believe is more accurate.
Steps to reproduce original issue:
Create a list with one element in it.
Press enter to add a second element element, and press enter again to remove it a start a new line.
Add a quote.
Notice that the list styling has disappeared.
Test
Create a list with one element in it.
Press enter to add a second element element, and press enter again to remove it a start a new line.
Add a quote.
Notice that the quote is added correctly and list style remains.
This behavior affects block styles, like Lists, Quotes and Headings.
Try testing it in various ways - applying block styles in the middle of multiline block element, at the beginning and at the end.
This PR fixes issue with adding new block spans right next to the existing ones, when
exclusiveBlocks
is set totrue
.To test this PR and the original issue you need to add
aztec:exclusiveBlocks="true"
toAztecText
layout.When
exclusiveBlocks
is set totrue
the block are replaced when other block style is applied to them (normal behavior is to allow multiple block style to be applied).Issue was caused because the range we used to detect spans we should remove included the span on the line before the cursor. I used the range logic from the toolbar highlight code, which I believe is more accurate.
Steps to reproduce original issue:
Test
This behavior affects block styles, like Lists, Quotes and Headings. Try testing it in various ways - applying block styles in the middle of multiline block element, at the beginning and at the end.