Why does a QullJS delta appear out of order?
Closed this issue · 0 comments
shamoons commented
The delta that's generated looks like:
{"ops":[{"retain":710},{"insert":" yesterday, and she says—”\n“The clinic?","attributes":{"prediction":"prediction"}},{"delete":28}]}
My code is:
const delta = new Delta()
.retain(documentData?.prediction?.currentPosition)
.delete(previousPredictionText?.length || 0)
.insert(predictionText, { prediction: 'prediction' })
console.log('delta', JSON.stringify(delta))
quillEditor.updateContents(delta)
It looks like I should first retain
, then delete
, then insert
, but the generated delta
seems to do it in a different order. What am I doing wrong?
Cross linked at https://stackoverflow.com/questions/63430548/why-does-a-qulljs-delta-appear-out-of-order if anyone wants magic internet points