sstur / react-rte

Pure React rich text WYSIWYG editor based on draft-js.
https://react-rte.org
ISC License
2.86k stars 430 forks source link

width and height attribute doesn't work for img #388

Closed xiaohanzhang closed 1 year ago

xiaohanzhang commented 3 years ago

I thing there are two issues here:

  1. draft-js-utils version is too low. It only support "src" and "alt" for in 0.2.0.
  2. ImageSpan doesn't handle width and height type properly. For example: <img width="100" height="100"/> will resolve into const imageStyle = {width: '100', height: '100'} in ImageSpan, and it will be ignored by react. And <img width="100px" height="100px"/> will resolve into const imageStyle = {backgroundSize: '100pxpx 100pxpx'}, which is also invalid.