Issue #1255✓ SolvedOpened July 3, 2018by jdodsoncollins2 reactions

How to set editor html contents from custom component?

Quick answerby artf2

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)

👍 Most helpfulartfJuly 11, 2018

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.

no-response[bot]July 21, 2018

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.