关于集成过程,请参看 https://blog.csdn.net/bigboysunshine/article/details/80117631 本文将集成后如何让图片宽度自适应.
使用ckeditor中发现,上传图片时,总会自动给img标签添加width和height的style内联样式,如图
这样宽高就固定死了.
好在插件本身有提供内容过滤功能,通过设置disallowedContent属性的相应规则,可以在CKEditor中强制禁用相应的HTML内容,包括元素以及其属性、类(class)、内联样式(style)等等.官方文档
方法如下:
1,在ckeditor中的config.js文件中,找到editorConfig并设置disallowedContent属性:
config.disallowedContent='img{width,height};img[width,height]';
这样就不会给img标签添加style属性如图
2,修改css样式
p img{
width: auto;
height: auto;
max-width: 100%;
display: block;
}
这样图片就可以自适应宽度了.
参考:https://shiyousan.com/post/636253649204480535