Issue #2787Opened May 18, 2020by JoLoZ0 reactions

[QUESTION] Replace all of HTML

Question

Hello there, I am trying to use GrapesJS for template customization for my end users, but ran in the following problem: There is no documented way which I can replace all of the content with something like a function.

I tried redirecting, but that, well... redirects.

What I have: -An exact copy of the demo page (I couldn't get the main thing running yet, but it's good enough for testing.) -Static .html files where I pull the templates from -A small script that catches URL arguments and tries to replace the content with the file from the base parameter. -PHP 7.4 (Could also switch to a bunch of other versions, including PHP 5) -An external catalogue, which redirects the browser to the editor with the base parameter set.

The content is comming like this:

<body>
<p>Imagen some content here. Get creative!</p>
<style>
</style>
</body>

Answers (1)

artfJune 9, 20200 reactions

Well a lot of things depend on your backend and there I can't help you, but if you need to replace the canvas with a new template you would use something like this

editor.setComponents(`<p>Imagen some content here. Get creative!</p>
<style>
</style>`)

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.