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
2 Answers
Reset to default 7According 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