editor.js
editor.js copied to clipboard
How does one get the already instantiated instance of the Editor JS by its id value when there are two or more instances of editorjs running in the same browser?
How does one get the already instantiated instance of the Editor JS by its id value when there are two or more instances of editorjs running in the same browser?
Currently const editor = new EditorJS({ holder: "my-id"});
- I no longer have access to the const editor
property, so I would like to use the id "my-id" to get hold of the instance. I'm struggling to find documentation to confirm or reject if this is possible. I do hope it's possible to do this?
Many thanks.
If you're using React (Gatsby, NextJS, etc.), you could use a singleton
pattern to retain the editor (what we do.)
Example: https://www.npmjs.com/package/react-singleton-hook
Hello, I'm just using straight up editorjs with no react or Nextjs etc and would like to know how to get the editor's instance in other functions.
I am experiencing the same issue !! I used to be able to access the instance the editor using window.editor, before introducing holder to the editor so we can have multiple instances, now it's broken, querySelecting the element id return just the raw html, no editor instance, how can I access the editor instance now ?