JiHong88 / suneditor

Pure javascript based WYSIWYG html editor, with no dependencies.
http://suneditor.com
MIT License
1.74k stars 309 forks source link

Custom attributes feature break after upgrade to 2.45.1 #1324

Open tapansharma opened 11 months ago

tapansharma commented 11 months ago

Describe the bug I add data-id and data-jsondata for editing purpose in all images. After the version upgrade to 2.45.1, I see onchange is removing these custom properties. Earlier this used to work (in version 2.43.14) and has only stopped working after the version upgrade

To Reproduce Steps to reproduce the behaviour:

  1. Using insertHTML add an image which has data-id and data-jsondata properties.
  2. See editor code view shows these properties
  3. But when you try to get this data using onChange function, these are missing from the html code

Expected behaviour <p>Test</p><div class="se-component se-image-container __se__float-"> <figure style="width: fit-content;"><img src="some_url.jpeg" data-jsondata="[{&quot;x&quot;:348.53125,&quot;y&quot;:156.734375,&quot;src&quot;:&quot;/beta/physics_editor/svg/2022/9/28/1664355506_PE_candle.svg&quot;,&quot;type&quot;:&quot;image&quot;,&quot;id&quot;:&quot;660a3b6a-2533-419d-97d5-3b6fdb5997de&quot;,&quot;index&quot;:1,&quot;width&quot;:200,&quot;height&quot;:200,&quot;rotation&quot;:0}]" data-id="phys-32c35a1b-6419-4a61-880f-5dd8cfc562e9" style="width: fit-content;" alt="" data-proportion="true" data-align="" data-index="0" data-file-name="1698215776.jpeg" data-file-size="0" data-origin="fit-content," data-size="fit-content,"></figure></div><p>​&nbsp;<br></p>

Current behaviour <p>Test</p><div class="se-component se-image-container __se__float-"><figure style="width: fit-content;"><img src="some_url.jpeg" alt="" data-proportion="true" data-align="" data-file-name="1698215776.jpeg" data-file-size="0" data-origin="fit-content," data-size="fit-content," style="width: fit-content;"></figure></div><p>​&nbsp;<br></p>

Desktop (please complete the following information):

tapansharma commented 11 months ago

Hi @JiHong88, please look into this regression.