question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot insert link by insertEmbed API

See original GitHub issue

I cannot insert link by insertEmbed API (version 1.3.7).

<link href="https://cdn.bootcdn.net/ajax/libs/quill/1.3.7/quill.snow.min.css" rel="stylesheet">
<div id="editor">
  <p>Hello World!</p>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/quill/1.3.7/quill.min.js"></script>
<script>
var editor = new Quill('#editor', { theme: 'snow' });
editor.insertEmbed(0, 'image', 'https://www.baidu.com/img/flexible/logo/pc/result.png', 'api'); // it works
editor.insertEmbed(1, 'link', { href: 'https://www.google.com', innerText: 'google' }, 'api');  // not works
</script>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
jvnlwncommented, Aug 3, 2021

While I do not know if Quill supports inserting a link using the insertEmbed method, it does support inserting a link using the insertText method.

Here’s the related insertText API:

insertText(
  index: Number,
  text: String,
  format: String,
  value: any,
  source: String = 'api'
): Delta

Found this example under docs for find.

quill.insertText(0, 'Hello', 'link', 'https://world.com');

I have tested with version 1.3.7 and it works.

0reactions
babaiwancommented, Jul 29, 2021

make sure you have registered the insert class correctly

the quill will find your blots in all registered blots firstly

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Insert a link in a specific index in quill editor - Stack Overflow
But i am getting this error , Cannot read property 'dangerouslyPasteHTML' of undefined. But i have defined the editor already. IS there a...
Read more >
API - Quill Rich Text Editor
insertEmbed. Insert embedded content into the editor, returning a Delta representing the change. Source may be "user" , "api" , or "silent" ....
Read more >
Insert a video from YouTube or another site - Microsoft Support
On the toolbar ribbon, select the Insert tab, select Video, and then select Online Video. The Insert Video dialog box opens. Paste the...
Read more >
Insert/Embed other file formats like .xlsx and .docx (but not ...
sql, .xlsx, .txt, .docx, etc. I believe I can achieve this by [text link](absolute file path), but can't make it work for a...
Read more >
Cloning Medium with Parchment · Quill官方中文文档 - 看云
开发者可以通过简单的API来控制编辑器的内容。 ... Block blots cannot. ... Our click handler calls insertEmbed() , which does not as convienently determine, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found