Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image width/height compatibility for outlook #1258

Closed
MatthSHo opened this issue Jun 9, 2023 · 2 comments
Closed

image width/height compatibility for outlook #1258

MatthSHo opened this issue Jun 9, 2023 · 2 comments
Milestone

Comments

@MatthSHo
Copy link

MatthSHo commented Jun 9, 2023

Html code generated from suneditor containing img tag works great everywhere except in outlook mail where size value set in style attribute gets ignored.

For instance with an image real width 500px, this adds the image with a width 500px in outlook and 300px everywhere else.
<img src="myImage-width-500.jpg" style="width:300px;">
whereas this works and display an image 300px
<img src="myImage-width-500.jpg" width="300" style="width:300px;">

Would it be possible to set (when defined) width and/or height attribute in image plugin setSize function (not only the value in style) ?

I tried to parse and fix the generated html but this is much less efficient than manipulating the img tag when generated.
I was not able to find a clean way to register any js code to do it on the SUNEDITOR object.

@stryzhak
Copy link

I've experienced same thing and modify following function with little tweak

_module_saveCurrentSize: function (contextPlugin) {

     _module_saveCurrentSize: function (contextPlugin) {
            const x = this.plugins.resizing._module_getSizeX.call(this, contextPlugin);
            const y = this.plugins.resizing._module_getSizeY.call(this, contextPlugin);
            contextPlugin._element.setAttribute('width',x.replace('px',''));
            contextPlugin._element.setAttribute('height',y.replace('px',''));
            contextPlugin._element.setAttribute('data-size', x + ',' + y);
            if (!!contextPlugin._videoRatio) contextPlugin._videoRatio = y;
        },

@melloware
Copy link
Contributor

@stryzhak can you submit a PR?

@JiHong88 JiHong88 added this to the 2.45.2 milestone Sep 7, 2023
JiHong88 added a commit that referenced this issue Apr 8, 2024
@JiHong88 JiHong88 closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants