How to set editor html contents from custom component?
Well with this this.attributes.template = ... you do nothing to the view so it's just empty. You have to update the model so the view reacts to the change. Eg.
Read full answer below ↓Question
I'm having trouble getting a custom block+component to display its template HTML inside the grapes editor. Within the exported HTML, the markup and CSS is generated as expected. Within the editor though, the block doesn't leave behind any sort of UI (though it is dragging in successfully based on the exported html/css) My question is: What is the proper way to have the 'toHtml' method output also apply to the editor iframe? Based on similar examples I see elsewhere, it seems like in every other case it has to be generated from the block content property. However, for reasons I'm omitting here...
Answers (3)
Well with this this.attributes.template = ... you do nothing to the view so it's just empty. You have to update the model so the view reacts to the change. Eg.
This custom component is an adaptation of https://github.com/artf/grapesjs-blocks-flexbox
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we ne...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
Issue #1493
[QUESTION] render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
Issue #2008
[Question]The canvas turns dark and unmodifiable on adding a large piece of custom html.
I used to add custom html with editor.addComponent(). It works well at most of the time, but when I try to insert a large piece of HTML whi...
Issue #1693
[BUG|/QUESTION] Strange characters (Â) within CSS/HTML preview; Elements are not deleted completely
BUGAre you using the latest release (older versions are NOT supported)?0.14.50Are you facing the bug with your local copy of GrapesJS or wi...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.