Reputation: 174329
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 component that can be plugged into existing websites that enhances their editors, and I need a way to get their editor instance.
Upvotes: 3
Views: 5295
Reputation: 665
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);
Upvotes: 6
Reputation: 174329
This can be done by using Quill.find('#editor');
, see https://quilljs.com/docs/api/#find-experimental
Upvotes: 1