[QUESTION] gjs-component is not updated with my traits values
Question
Hi, have I modified my HTML using the toHTML function in traits. An HTML element is updated but the gjs-component is not updated still it shows the old code.
my traits are
toHTML: function () {
const html = this.view.el.innerHTML;
const name = this.get('traits').where({ name: 'name' })[0].get('value');
const value = this.get('traits').where({ name: 'value' })[0].get('value');
let renderHtml = `<input type="radio" `;
if (name) {
renderHtml += ` name="${name}" `;
}
if (value) {
renderHtml += ` value="${value}" `;
}
renderHtml += `class="radio"/>`;
return renderHtml;
}
but its shows older code like type="radio" is not stored in gjs-component after i loaded my saved screens
before saving the screen

after saved and load into grapesjs using
editor.setComponents(JSON.parse(existScreenDetail[0]['gjs-components']));
but its

can any please help me.
Answers (2)
I barely understand you here... please provide a reproducible demo
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
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 #1696
Traits appear first time when draged custom component
Hi artf , i have created custom component and add traits for it , when dragging this component to editor and select it the setting traits w...
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...
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.