Suneditor: Inserting image with height/width thru insertHTML() method resize automatically

Created on 28 Apr 2020  路  4Comments  路  Source: JiHong88/SunEditor

Hi,

Is there a way to insert images thru .insertHTML() method with size indicated like <img height="100" width="100" src="..." /> ?

Right now when I tried to insert image with height/width indicated it still auto resize.

Thank you.

bug

All 4 comments

Hi,
The inserted tag has the attributes removed according to the "whitelist" of option.
If you give the second argument value of .insertHTML true, html clean will not work.
And please specify the size in style.

.insertHTML('<img style="height:100px; width:100px;" src="..." />', true)
style="height:100px; width:100px;"

I did try to add .insertHTML('<img style="height:100px; width:100px;" src="..." />', true)
it's inserting the image with the indicated size but then it resets to its original/auto size.
perhaps i need to add the attributes in the whitelist option? can you provide an example?

Sorry, the "auto" size is being set while re-creating the image format.
It will be fixed once a new version is released this week.
I'll notify you know when the version is updated.

The 2.29.0 version has been updated.
If this issue has not been resolved, please reopen this issue.
Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Saeeed-B picture Saeeed-B  路  7Comments

drnkwati picture drnkwati  路  8Comments

dreamsight picture dreamsight  路  5Comments

vuvansang07 picture vuvansang07  路  4Comments

redone80 picture redone80  路  4Comments