[Question] Load basic block component fromElement
Question
I probably missed it somewhere in the docs but could not find it.
I'd like to a "form" block inside a "column" block on page load fromElement and also when clearing the canvas using editor.setComponent().
With mjml I would do editor.setComponents('<mjml><mj-body><mj-container>... but what's the equivalent with the webpage preset?
Answers (2)
The recognition of the component depends on this https://github.com/artf/grapesjs/wiki/Components#component-recognition So the "form", for example, is recognized just be the tagName so you don't need to do anything else, but the "column" it's not a component, its just an HTML block.
When you need, you can strictly declare the component type in this way
<div data-gjs-type="text">
<span>Don't parse the inner span, just treat it as a text component</span>
</div>
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1831
[Question] How to run command for a block component?
I'd like to do something like this. so once a user drops the test component into the canvas, I'd like to open up asset manager modal where...
Issue #1875
[QUESTION] ID changes when importing html or passing html in components prop in config.
Hi, I built a component and block that I can drag and drop in the canvas. My issue is that some styles rely on the ID. I know this might no...
Issue #580
[Question] Any/Trigger event when any block is dropped inside canvas?
Hey, How can I trigger some event when any new block or content inside canvas is updated? Something like editor.onCanvasUpdate() Thanks!
Issue #1587
How to distinguish events for custom components
Hi, I have an issue with events. I would like to distinguish events wwhen a component is loaded using 'fromElement' config from when it's l...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.