-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Description
We're using the RichTextEditor in Delta format (JSON) mode, and the value is bound to a String field that is stored in the database. When the component is loaded with existing Delta format data then extra whitespace is removed (tabs, spaces).
Expected outcome
We'd expect the text to appear as it was when it was saved, with extra whitespaces preserved.
For example when populating the component with this data:
[{"attributes":{"bold":true},"insert":"Line 1"},{"insert":"\n\tIndent 1\n\t\tIndent 2\nLast line with\textra spaces and a \ttab\n\n"}]
then when expect to get the same data back, but now we get:
[{"attributes":{"bold":true},"insert":"Line 1"},{"insert":"\nIndent 1\nIndent 2\nLast line with extra spaces and a tab\n"}]
Minimal reproducible example
getBinder().forField(ingredientListEditor.asDelta())
.bind(product -> product.getIngredientList(), (product, s) -> {
product.setIngredientList(s);
});
Steps to reproduce
- Create RichTextEditor component
- Write text that contains tabs and extra spaces into the editor component
- Retrieve the JSON Delta format data from the component (should be correct at this point)
- Re-populate the component with the retrieved data
- Observe that the extra whitespace has been removed
Environment
Vaadin version(s): 24.1.10
OS: Windows 10
Browsers
Chrome