Because I first applied green-over-white-background and then white-over-green-background, the nesting of the span elements is according to the chronological order here.
Case two: bug
If I try however the other way around, first white-over-green and then green-over-white:
Then I have the style applied, but it is not shown:
If I look at the generated HTML then I can understand the reason why:
The second applied style (green-over-white-background) is wrapping the first (white-over-green-background). This is correct based on the order I declared my options but wrong based on the order I applied the styles chronologically.
Hello to everybody, I want to report an interesting bug I found in the stateToHMTL function.
Code
I have an array of CSS classes as options:
data.ts
I use this array to generate the options for the Draftjs to HTML conversion:
get-options.ts
And I convert the editor state to HTML using the stateToHTML function:
get-html.ts
Case one: expected behaviour
Now I go to my application and select a text to mark it as green-over-white:
And then a nested part of the text to mark it as white-over-green:
The result is the one I would expect (a nested green inside the white):
The generated HTML is also the expected:
Because I first applied green-over-white-background and then white-over-green-background, the nesting of the span elements is according to the chronological order here.
Case two: bug
If I try however the other way around, first white-over-green and then green-over-white:
Then I have the style applied, but it is not shown:
If I look at the generated HTML then I can understand the reason why:
The second applied style (green-over-white-background) is wrapping the first (white-over-green-background). This is correct based on the order I declared my options but wrong based on the order I applied the styles chronologically.