Insert delta where the cursor is
See original GitHub issueHi 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 using updateContents
.
Steps for Reproduction
Here is the code for it -
const addVideoRange = this.editor.getSelection();
const newRange = addVideoRange !== null ? addVideoRange.index : 0;
// get the iFrame
const safeHtml = this.embedService.embed(url, {
attr: { width: 600, height: 400 },
});
// converting safeHTML to Delta to insert into the Quill editor
const delta = this.editor.clipboard.convert(safeHtml.changingThisBreaksApplicationSecurity);
// "silent" source so selection-change event is not emitted
this.editor.updateContents(delta, 'silent');
this.editor.setSelection(1 + newRange);
Here is how I want it to work (insertEmbed
embeds the video where the cursor is) -
const addVideoRange = this.editor.getSelection();
const newRange = addVideoRange !== null ? addVideoRange.index : 0;
this.editor.insertEmbed(newRange, 'video', url);
this.editor.setSelection(1 + newRange);
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
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
How to Insert or Type the Delta Symbol in Word (Δ or δ)
Position the cursor in the document where you want to insert the Delta symbol. Click the Insert tab in the Ribbon. In the...
Read more >How to Insert Delta Symbol in Excel & Google Sheets
Hold down the Alt key, then type ALT + 30, to insert the delta (Δ) symbol into Excel. For lowercase delta, type ALT...
Read more >Setting the cursor position after setting a new delta in Quill
I'm trying insert a new sentence to a Quill's delta when an edit is made to the Quill, all the while retaining the...
Read more >Cannot add delta marker between horizontal cursor just as ...
If you click on the arrow between the two lines and drag in a horizontal direction (to the right), you should see the...
Read more >Using Mouse Cursor + Delta To Play a Game ... - YouTube
It started as a silly meme but I wanted to see if I COULD actually get something working through move mouse cursor and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
quill.updateContents(new Delta().retain(cursorIndex).concat(myDeltas))
https://quilljs.com/docs/api/#api