Hi,
I never tried this but have you tried adding following setting in the initialization module or tiny init method
image_dimensions: false
https://www.imthi.com/blog/web/tinymce-remove-height-width-from-image.php
Hi veckly,
It's strange, it seems like image_dimensions
should work.
You could try something like this: https://gist.github.com/simshaun/7592631 (there may be a better example somewhere, this was just the first I found).
To use it you'd need to do something like:
.AddExternalPlugin("remove-img-dimensions", "/ClientResources/Scripts/tinymce/remove-img-dimensions.js")
Where that path is, of course, the path to your JS file.
Documentation is here: https://world.episerver.com/documentation/developer-guides/CMS/add-ons/customizing-the-tinymce-editor-v2/plug-ins/
Hi Jake,
Logically it seems that image_dimensions: false would work.
But according to the documentation, and from what I've experenced, "This options allows you disable the image dimensions input field in the image dialog." It doesn't remove the attributes from the image tag in the code. Also, it looks like this issue has been going on for a while now.
https://github.com/tinymce/tinymce/issues/2225
You can clear the dimentions in the input fields, but seeing that I managed hundreds of web authors having them all to remember to do this is an issue which can't be solved without a couple of bottles of whatever poison you prefer.
So clearing it out in the code is the best thing I can come up with and the plugin option may be the best. I'll play around with that and see if I can find something that works.
I also need to add limits as to the images they can upload, and your blog posts have given me some pretty good advice and how to impliment that.
Hello,
I've been trying to programmatically remove the height and width attributes from the images via TinyMce
I've tried added a few things to to my initialization, but not of them seem to work.
It should be something simple like this:
But that doesn't seem to remove the height and width attributes.
invalid_elements only works on elements, not attributes.
image_dimensions removes the dimentions settings in the editor but not the code