Set the element after instantiation
See original GitHub issueIs your feature request related to a problem? Please describe. Instantiation
Describe the solution you’d like I’d like to be able to create the editor without an element, and use a method to set the element elsewhere in my app.
This way we can create the editor() without having to know if the DOM is ready, nor which element will be responsible for rendering. This will help me decouple the various UI elements for my application, ie:
// Pseudocode
const tiptap = new Editor({ ... });
<Container>
<Toolbar>
<Sidebar>
<Editor-Document>
<Breadcrumbs>
</Container>
^ in this example the <Editor-Document>
may get access to tiptap
and call tiptap.setElement(...)
once ready. Other components may also get access to tiptap
to listen to events etc.
Describe alternatives you’ve considered
Tried this without success
// Create without an element:
editor = new Editor({ ... });
// Set the element later
editor.setOptions({ element: document.getElementById('the-editor'), });
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Set the element after instantiation · Issue #1161 - GitHub
I can wait for the DOM, but it means I have a round trip - I want the editor to be created without...
Read more >Can one add React Keys after instantiation? - Stack Overflow
I'm making a collection of React Elements and displaying them; what follows is a trivial example to frame the problem of ...
Read more >Set - JavaScript - MDN Web Docs - Mozilla
The Set object lets you store unique values of any type, whether primitive values or object references.
Read more >Problem with instantiate UI prefabs - Unity Forum
When I instantiate prefab with RectTransform on it in most cases it works wrong. Usually ancoredPosition and deltaSize resets and I have to ......
Read more >Different ways to instantiate an object in C++ with Examples
example *obj2 = new example(): This is the way of instantiating an object that has dynamic storage duration. This object will not be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, I updated the documentation!
Since I can’t fork the repo, this is my docs proposal:
https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages/api/editor.md
Init before mounting
You can initiate your editor before mounting. This is useful when your DOM is not yet available, or you want to decouple the editor from the DOM.
You can then mount the element at a later date.