GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

[QUESTION] gjs-component is not updated with my traits values #1977

Closed Ramkumar-Murugesan closed 5 years ago

Ramkumar-Murugesan commented 5 years ago

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

image

after saved and load into grapesjs using

editor.setComponents(JSON.parse(existScreenDetail[0]['gjs-components']));

but its

image

can any please help me.

artf commented 5 years ago

I barely understand you here... please provide a reproducible demo

lock[bot] commented 4 years ago

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.