我正在制作一个电子邮件程序网站,允许您上传图像。您可以调整图像大小,但它将被编写为内联样式:style="width: X; height: X"
。
当您想在 Outlook 中预览电子邮件时,图像将以完整宽度和高度显示。
所以而不是
<img src="x" style="width: x; heigth: x";>
我要
<img src="x" width="x" heigth="x">
我目前使用的是最新版本的CKEditor:V4.7.3
最佳答案
请参阅:https://docs.ckeditor.com/ckeditor4/docs/#!/guide/dev_acf-section-example%3A-disallow-inline-styles-and-use-attributes-instead 。此链接准确描述了您正在寻找的内容。
请注意,要实现此功能,需要启用高级内容过滤器 (ACF)。如果您不熟悉,请参阅:
- http://docs.ckeditor.com/#!/guide/dev_acf
- http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
- http://docs.ckeditor.com/#!/guide/dev_disallowed_content
- http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations
- http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent
- http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent
关于javascript - CKEditor 图像宽度和高度作为 HTML 属性而不是内联样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46824823/