JiHong88 / suneditor

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

Percentage width set on an image is lost on saving #1334

Closed JFox23 closed 3 months ago

JFox23 commented 8 months ago

Describe the bug After inserting an image and resizing it to 50% width, the style attribute on the component div is removed by core.cleanHTML().

To Reproduce Steps to reproduce the behavior:

  1. Insert an image
  2. Use the image plugin controls to resize it to 50%
  3. Click on the save button
  4. Check textarea content for style attribute on the image component div (which is removed)

Expected behavior I expect the style="width: 50%" attribute to remain intact. Or else loading the saved content in an editor instance will present an image with 100% width.

Desktop (please complete the following information):

Additional context I will provide a Pull request that adds the width attribute to _cleanStyleRegExp.format.