delta
delta copied to clipboard
Get incorrect delta by Delta.transform
Delta package version: 4.2.2
In my use case, the results obtained by Delta.transform
were not as expected.
It caused undo
doesn't work as expected in the table.
I suspect that in this case, the delete
operation was moved to the end causing this issue. Does any have a solution?
Thanks a lot:)
Before undo:
After undo:
Expected results:
Original delta in undo stack
{
"ops": [
{
"retain": 4
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-jj2vxw",
"cell": "cell-jkfu51"
},
}
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-pzu42n",
"cell": "cell-5s14ao"
},
}
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-pzu42n",
"cell": "cell-oc2pfj"
},
}
},
{
"retain": 1,
"attributes": {
"table-cell-line": null,
"row": null,
"cell": null,
"rowspan": null,
"colspan": null
}
},
{
"delete": 1
}
]
}
delta for remote changes
{
"ops": [
{
"retain": 7
},
{
"insert": "2"
}
]
}
transformed delta in undo stack
{
"ops": [
{
"retain": 4
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-jj2vxw",
"cell": "cell-jkfu51"
},
}
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-pzu42n",
"cell": "cell-5s14ao"
},
}
},
{
"retain": 1,
"attributes": {
"table-cell-line": {
"row": "row-pzu42n",
"cell": "cell-oc2pfj"
},
}
},
{
"retain": 1
},
{
"retain": 1,
"attributes": {
"table-cell-line": null,
"row": null,
"cell": null,
}
},
{
"delete": 1
}
]
}