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
If I understand correctly, for diff to work, a document has to contain ONLY insert Op.
But the result of .compose() contains delete Op.
You may run this simple Node code to reproduce the problem.
constDelta=require("quill-delta");constoldContent=newDelta([{insert:
"Well, you see... I'm buying this hotel and setting some new rules about the pool area. Well, you see... I'm buying this hotel and setting some new rules about the pool area. Bruce Wayne, eccentric billionaire. ",},{insert: {citation: {citationId: "2066",label: "1",},},},{insert: "\n",},]);// This was generated from delta.diff(anotherDelta)constdiff=newDelta([{delete: 13,},{retain: 2,attributes: {color: null,},},{delete: 27,},{retain: 1,attributes: {color: null,},},{delete: 1,},{retain: 1,attributes: {color: null,},},{delete: 4,},{retain: 1,attributes: {color: null,},},{delete: 25,},{retain: 1,attributes: {color: null,},},{insert: {citation: {citationId: "2063",label: "1",},},},{delete: 484,},]);constnewContent=oldContent.compose(diff);console.log(newContent);// result:// [ { insert: '.. eg ' }, { insert: [Object] }, { delete: 347 } ] }newContent.diff(newDelta());// getting error `diff() called with non-document`// because the `compose` result contains `delete`
is it a bug that .compose() returns delete Op?
how can I use diff() without getting the error diff() called with non-document ?
The text was updated successfully, but these errors were encountered:
jacobgoh101
changed the title
result of .compose() contains delete Ops, which subsequently causes error diff() called with non-document
result of ".compose()" contains "delete" Ops, which subsequently causes error "diff() called with non-document"
Apr 10, 2020
Many thanks for this library.
I am facing this error
diff() called with non-document
.After some digging, I realized that the error is thrown from this line from
quill-delta
https://github.com/quilljs/delta/blob/06ca777f67905ea6533272b2f88189ee06bb4197/src/Delta.ts#L278If I understand correctly, for
diff
to work, a document has to contain ONLYinsert
Op.But the result of
.compose()
containsdelete
Op.You may run this simple Node code to reproduce the problem.
.compose()
returnsdelete
Op?diff()
without getting the errordiff() called with non-document
?The text was updated successfully, but these errors were encountered: