Ways to load Html content through reactjs wrapper
Question
@artf Bro, I want to load the html page which contains css and js for effects (parallax). I worked around 10 days but still I cant able to find whether am doing it right. So can you provide me instructions to do it in correct way. Ultimate goal is to provide set of templates for the user in the react wrapper page and once user picks any template, system will load the selected template into the grapesjs editor. So Please me to get out of this issue. Thanks in advance.
Answers (3)
@artf Bro, I want to load the html page which contains css and js for effects (parallax). I worked around 10 days but still I cant able to find whether am doing it right. So can you provide me instructions to do it in correct way. Ultimate goal is to provide set of templates for the user in the react wrapper page and once user picks any template, system will load the selected template into the grapesjs editor. So Please me to get out of this issue. Thanks in advance.
Hi Bro Any update on Grapesjs with react ?
@artf Bro, I want to load the html page which contains css and js for effects (parallax). I worked around 10 days but still I cant able to find whether am doing it right. So can you provide me instructions to do it in correct way. Ultimate goal is to provide set of templates for the user in the react wrapper page and once user picks any template, system will load the selected template into the grapesjs editor. So Please me to get out of this issue. Thanks in advance.
Hi Bro Any update on Grapesjs with react ?
In your react component's componentDidMount() you can initialize the editor like below:
var editor;
componentDidMount{
editor = grapesjs.init({
container: "#editor-portal",
allowScripts: 1,
height: "100vh",
canvas: {
styles: selectedTemplateExternalStyles,
scripts: selectedTemplateExternalScripts
},
plugins: ["gjs-preset-webpage", "grapesjs-custom-code"],
pluginsOpts: {
"gjs-preset-webpage": {
exportOpts: {
filenamePfx: "hc",
filename: null,
addExportBtn: 1,
btnLabel: "Export to ZIP"
}
},
"grapesjs-custom-code": {}
},
storageManager: {
id: "gjs-",
type: "remote",
autosave: 1,
autoload: 1,
stepsBeforeSave: 1, // If autosave enabled, indicates how many steps (general changes to structure), need to be done before save. Useful with remoteStorage to reduce remote calls
urlLoad: API_ROOT + "/template/get/" + this.state.editorType + "/" + this.props.templateId,// Endpoint where to fetch data
urlStore: API_ROOT + "/template/save/" + this.props.templateId, // Endpoint where to save all stuff
headers: { "x-apiKey": "XXXXXXXXXXXX" },
contentTypeJson: true // false: 'x-www-form-urlencoded' // true: application/json; charset=utf-8' // set contentType paramater of $.ajax
}
});
}
I loaded html content from remote storage. Can you tell me how you like to get the html for your editor canvas?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1445
Display Preview based on JSON data
@artf How can we display preview based on JSON data into the next page. Currently we are saving josn html & css and plain css and Html for...
Issue #1263
How can i embed a modal and be able to edit it in my html content
Good Day I am trying to add a modal into my html, I was able to add a modal in the blockmanager but i am struggling to find ways to edit th...
Issue #1609
Grapesjs, How to extract html/css code in view code into console log?
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #1742
How to load local css in to canvas of grapesjs editor in React ? Css path is not taking
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
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.