Closed sohinim98 closed 8 months ago
you can try to add it
this.quill.insertText(newRange + 1, ' ');
quill.updateContents(new Delta().retain(cursorIndex).concat(myDeltas))
@anis8 how do you know this? it is not in the docs from what I can see?
quill.updateContents(new Delta().retain(cursorIndex).concat(myDeltas))
Hey @anis8 thanks for this, I had to make some changes to make this works but your comment put me on the right track my final solution was:
// Add 1 because my new delta is 1 length size
const newCursorPositionAfterUpdating = currentPosIndex + 1;
quill
.updateContents(new Delta().retain(cursorIndex).insert("x"))
.concat(myDeltas))
// Remove deltas before inserting otherwise we duplicate deltas.
.delete(newCursorPositionAfterUpdating)
@anis8 how do you know this? it is not in the docs from what I can see?
Hi there, I am using
updateContents
to insert the delta for an iframe for a video, and would like to enter the iframe delta where the cursor is. However, right now the iframe is always inserted at the top of the editor usingupdateContents
.Steps for Reproduction
Here is the code for it -
Here is how I want it to work (
insertEmbed
embeds the video where the cursor is) -Expected behavior: For the video iFrame to be embedded where the cursor is, the way insertEmbed works.
Actual behavior: The iFrame is embedded in the beginning of the document.
Note that I cannot use insertEmbed because I have to insert html/delta.
Version: 1.3.7