Closed sebastianha closed 7 years ago
Hi @sebastianha thanks for the hint I think I forgot to mention one important step in docs.
<div id="gjs">
...
<cutom-element></cutom-element>
...
</div>
<script>
var editor = grapesjs.init({
container : '#gjs',
fromElement: true,
});
editor.DomComponents.addType('cutom-element-type', {...});
</script>
In the example above the editor will not get the new type from the HTML because the content is already parsed and appended, so it'll get it only with new components (eg. from Blocks)
Solution 1: turn off autorender
<script>
var editor = grapesjs.init({
autorender: 0,
container : '#gjs',
fromElement: true,
});
editor.DomComponents.addType('cutom-element-type', {...});
// after all new types
editor.render();
</script>
Solution 2: put all the stuff inside a plugin (Creating plugins)
Could you try and let me know? If it's not working please post some reproducible example.
That's it, thank you very much!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I am currently trying to implement by own custom component type and it seems to me that the html parser does not honor custom component types with their isComponent method and therefore they are not recognized as components. Can you reproduce this?