grapes js version v0.16.34 giving unexpected script code after loading saved html
Question
attaching code:
while saving the html:
<div class="gjs-row">
<div class="gjs-cell">
<div class="gjs-row">
<div class="gjs-cell">
<div id="i6x6">
<div id="bsrne9exd5" style="height:300px" tg="DataGrid" tagName="DataGrid" class="ag-theme-alpine">
</div>
</div>
</div>
<div class="gjs-cell">
<div id="ibc4">
<div id="3drqn6v2q5" style="height:300px" tg="DataGrid" tagName="DataGrid" class="ag-theme-alpine">
</div>
</div>
</div>
</div>
</div>
</div>
<script>var items = document.querySelectorAll('#i6x6');
for (var i = 0, len = items.length; i < len; i++) {
(function(){
var columnDefs = [{
headerName: 'Make', field: 'make',sortable: true, filter: true}
, {
headerName: 'Model', field: 'model',sortable: true, filter: true}
,{
headerName: 'Price', field: 'price',sortable: true, filter: true}
];
var rowData = [{
make: 'Toyota', model: 'Celica', price: 35000}
,{
make: 'Ford', model: 'Mondeo', price: 32000}
,{
make: 'Porsche', model: 'Boxter', price: 72000}
];
var gridOptions = {
defaultColDef: {
resizable: true }
,columnDefs: columnDefs,rowData: rowData};
var gridDiv = document.getElementById('bsrne9exd5');
new agGrid.Grid(gridDiv, gridOptions);
}
.bind(items[i]))();
}
var items = document.querySelectorAll('#ibc4');
for (var i = 0, len = items.length; i < len; i++) {
(function(){
var columnDefs = [{
headerName: 'Make', field: 'make',sortable: true, filter: true}
, {
headerName: 'Model', field: 'model',sortable: true, filter: true}
,{
headerName: 'Price', field: 'price',sortable: true, filter: true}
];
var rowData = [{
make: 'Toyota', model: 'Celica', price: 35000}
,{
make: 'Ford', model: 'Mondeo', price: 32000}
,{
make: 'Porsche', model: 'Boxter', price: 72000}
];
var gridOptions = {
defaultColDef: {
resizable: true }
,columnDefs: columnDefs,rowData: rowData};
var gridDiv = document.getElementById('3drqn6v2q5');
new agGrid.Grid(gridDiv, gridOptions);
}
.bind(items[i]))();
}
</script>
after saving the code become:
<div class="gjs-row">
<div class="gjs-cell">
<div class="gjs-row">
<div class="gjs-cell">
<div id="iepv">
<div id="4h942l66s5" tg="DataGrid" tagname="DataGrid" class="ag-theme-alpine">
</div>
</div>
</div>
<div class="gjs-cell">
<div id="iiih">
<div id="l6r4s71nr5" tg="DataGrid" tagname="DataGrid" class="ag-theme-alpine">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="loader" class="loader text-center d-none">
<div id="ie5kf" class="spinner-border text-primary">
</div>
<div id="iqy34">Processing.........
</div>
</div>
<input type="hidden" id="solutionName" name="solutionName" value="finalTest"/>
<input type="hidden" id="templateId" name="templateId" value="29742b00-897b-4f4e-9a58-4c8c63b9a8d8"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"/>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://unpkg.com/ag-grid-community/dist/ag-grid-community.min.js"></script>
<script src="/utils.js"></script>
<script id="script_initial">$(document).ready(function(event){
utils.initialize()}
);
</script>
<script>var items = document.querySelectorAll('#iepv');
for (var i = 0, len = items.length; i < len; i++) {
(function(){
var columnDefs = [{
headerName: '
Make'
, field: '
make'
,sortable: true, filter: true}
, {
headerName: '
Model'
, field: '
model'
,sortable: true, filter: true}
,{
headerName: '
Price'
, field: '
price'
,sortable: true, filter: true}
];
var rowData = [{
make: '
Toyota'
, model: '
Celica'
, price: 35000}
,{
make: '
Ford'
, model: '
Mondeo'
, price: 32000}
,{
make: '
Porsche'
, model: '
Boxter'
, price: 72000}
];
var gridOptions = {
defaultColDef: {
resizable: true }
,columnDefs: columnDefs,rowData: rowData};
var gridDiv = document.getElementById('4h942l66s5');
new agGrid.Grid(gridDiv, gridOptions);
}
.bind(items[i]))();
}
var items = document.querySelectorAll('#iiih');
for (var i = 0, len = items.length; i < len; i++) {
(function(){
var columnDefs = [{
headerName: '
Make'
, field: '
make'
,sortable: true, filter: true}
, {
headerName: '
Model'
, field: '
model'
,sortable: true, filter: true}
,{
headerName: '
Price'
, field: '
price'
,sortable: true, filter: true}
];
var rowData = [{
make: '
Toyota'
, model: '
Celica'
, price: 35000}
,{
make: '
Ford'
, model: '
Mondeo'
, price: 32000}
,{
make: '
Porsche'
, model: '
Boxter'
, price: 72000}
];
var gridOptions = {
defaultColDef: {
resizable: true }
,columnDefs: columnDefs,rowData: rowData};
var gridDiv = document.getElementById('l6r4s71nr5');
new agGrid.Grid(gridDiv, gridOptions);
}
.bind(items[i]))();
}
</script>
editor.setComponents(HTML String); changing ' to ' like all the symbols like < or >are changin to browser undestanding way kindly help me out to resolve thisAnswers (2)
kindly any one help me to get out of this issue editor.setComponents(html text ); not working the script as expected after loading from saved template html while drag and drop its working after saving and again loading that html with editor.setComponents(html text ); then the existing script replacing the symbols like ' < > with browser related codes and this is happening in version v0.16.34 only
You can't load the generated HTML code back to the editor, read the documentation on how to correctly store and load templates https://grapesjs.com/docs/modules/Storage.html
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1577
Inline CSS Comments break Code Manager
Apparently this is valid piece of html and css: <div style="color: red; / height 200px; /; font-weight: bold;"> (Hence the commented out he...
Issue #2018
BUG When import as module Angular 6
in Version: "grapesjs": "^0.14.61", "grapesjs-preset-newsletter": "^0.2.20", i import the script as: and the context is the code: And only...
Issue #1817
Change HTML content while block is render in editor
Hello @artf I have one block into block manager like As per above script inside the block, i want to add dynamic HTML content while this bl...
Issue #2207
[BUG]: Can't drag component if there is some space on top/left with Mode Absolute
Given the following code example... Results in no ability to drag and drop elements to correct position using drag icon on the panel. See F...
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.