最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get Quill editor instance from HTML element - Stack Overflow

programmeradmin8浏览0评论

Assuming I created an editor instance for a certain element, e.g. via const editor = new Quill('#editor', {...some options});

Now, I would like to get this editor instance when only having the element available, e.g. something like const editor = Quill.existingEditorFromElement('#editor');

The reason is that I am building a ponent that can be plugged into existing websites that enhances their editors, and I need a way to get their editor instance.

Assuming I created an editor instance for a certain element, e.g. via const editor = new Quill('#editor', {...some options});

Now, I would like to get this editor instance when only having the element available, e.g. something like const editor = Quill.existingEditorFromElement('#editor');

The reason is that I am building a ponent that can be plugged into existing websites that enhances their editors, and I need a way to get their editor instance.

Share Improve this question asked Nov 4, 2020 at 18:44 Daniel HilgarthDaniel Hilgarth 174k40 gold badges344 silver badges449 bronze badges 1
  • Possible duplicate of stackoverflow./questions/41673629/… – Stephen Murumba Commented Feb 9, 2024 at 17:34
Add a ment  | 

2 Answers 2

Reset to default 7

According to Quill API Documentation you can get the editor instance by getting the DOM element by its ID (or classname or tagname...), and inserting it inside the find function.

Example:

var div = document.getElementById('editor');
var quill_instance = Quill.find(div);

This can be done by using Quill.find('#editor');, see https://quilljs./docs/api/#find-experimental

发布评论

评论列表(0)

  1. 暂无评论