知识学堂 > 课程 > KindEditor 上传图片加域名 修改大小 加宽度width="100%"

KindEditor 上传图片加域名 修改大小 加宽度width="100%"

发布日期:2023/6/2 来源:聚恒【返回】

1、加宽度width="100%"

kindeditor-all.js

查找“insertimage”手写 width="100%",注释判断

insertimage : function(url, title, width, height, border, align) {
title = _undef(title, '');
border = _undef(border, 0);
var html = '<img src="' + _escape(url) + '" data-ke-src="' + _escape(url) + '"  width="100%"';
//if (width) {
// html += 'width="' + _escape(width) + '" ';
//}
if (height) {
html += 'height="' + _escape(height) + '" ';
}
if (title) {
html += 'title="' + _escape(title) + '" ';
}
if (align) {
html += 'align="' + _escape(align) + '" ';
}
html += 'alt="' + _escape(title) + '" ';
html += '/>';
return this.inserthtml(html);
},


2、上传图片加域名

页面导入地方增加urlType:'domain',

 <script type="text/javascript">
        KindEditor.ready(function (K) {
            var editor1 = K.create('***********************', {
                cssPath: '***********************',
                uploadJson: '***********************',
                fileManagerJson: '***********************',
                allowFileManager: true,
                urlType:'domain',
                afterBlur: function () { this.sync(); }
            });
            prettyPrint();
        });
    </script>


3、修改上传大小限制

upload_json.ashx

//最大文件大小
int maxSize = 100000000;

上一章: 小程序跳转小程序 下一章: 评分