bobbingwide / sb-chart-block

Chart block for Gutenberg
GNU General Public License v3.0
6 stars 0 forks source link

Avoid unexpected reporting of "The following has been modified" from the site editor #37

Open bobbingwide opened 1 month ago

bobbingwide commented 1 month ago

As analysed in https://github.com/bobbingwide/bobbingwide/issues/135 the reason that content appears to have been modified when loaded in the Site editor is because it sets the value of the myChartId attribute from the ${ instanceId }

This value is then set in the id attribute of the <canvas> tag.

I don't think that the myChartId attribute is needed.

bobbingwide commented 1 week ago

How will this affect blocks that have already been created?

We should be able to cater for these by adding deprecated logic that will convert from blocks with the myChartId to blocks that don't need the myChartId attribute. The server side generated code will still use the id attribute on the <canvas> tag, but that's always been generated... the myChartId value wasn't being used.