You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're seeing some cases where serializing separate DocumentNodes to deltas results in multiple nodes being merged into single deltas when they should be separate deltas.
The merging action happens at the delta level - the originating DocumentNodes are irrelevant.
Reproduction deltas
Start with a serialized delta:
{
"insert": "This paragraph is above the styled one:\n"
}
Then add another delta by executing TextBlockDeltaSerializer.serialize(node, deltas), which produces an intermediate delta like the following:
{
"insert": "This is a block styled paragraph.",
"attributes": {
"banner-color": "red"
}
}
Due to the delta merge decision within TextBlockDeltaSerializer we end up with a final single delta:
{
"insert": "This paragraph is above the styled one:\nThis is a block styled paragraph.",
"attributes": {
"banner-color": "red"
}
}
What we want to end up with is:
{
"insert": "This paragraph is above the styled one:\n"
},
{
"insert": "This is a block styled paragraph.",
"attributes": {
"banner-color": "red"
}
}
The text was updated successfully, but these errors were encountered:
In the original description I said that the following was a bad merge:
{
"insert": "This paragraph is above the styled one:\nThis is a block styled paragraph.",
"attributes": {
"banner-color": "red"
}
}
I think this is actually a correct merge. If I remember correctly, Quill Deltas don't blindly apply attributes to all text in the insert. Instead, every newline creates a barrier, even when the newline is in the same Delta. Therefore, when this Delta is processed, the first line gets a paragraph, and no attributes are applied. Then, the second line gets a paragraph, and the attributes are applied to that second paragraph. This results in the desired output.
We're seeing some cases where serializing separate
DocumentNode
s to deltas results in multiple nodes being merged into single deltas when they should be separate deltas.The merging action happens at the delta level - the originating
DocumentNode
s are irrelevant.Reproduction deltas
Start with a serialized delta:
Then add another delta by executing
TextBlockDeltaSerializer.serialize(node, deltas)
, which produces an intermediate delta like the following:Due to the delta merge decision within
TextBlockDeltaSerializer
we end up with a final single delta:What we want to end up with is:
The text was updated successfully, but these errors were encountered: