PHPcms v9 去掉编辑器上传图片的宽高样式

分类:建站教程 时间:2024-12-22 19:00 浏览:0 评论:0
0

PHPcms v9  CKEditor 上传图片后会给图片自动加上行内的宽高样式  如下图:

如果是bootstrap 响应式网站手机端图片就会变形,没次都要在行内删除样式,麻烦!!

去掉 自动设置宽高的样式修改 编辑器文件:

/statics/js/ckeditor/plugins/image/dialogs/image.js      

格式化js后,共找到2处,分别是宽高的js,第405行:

if (B == d) {
    if (E) C.setStyle('width', CKEDITOR.tools.cssLength(E));
    else C.removeStyle('width'); ! D && C.removeAttribute('width');
} else if (B == f) {
    var F = E.match(h);
    if (!F) {
        var G = this.getDialog().originalElement;
        if (G.getCustomData('isReady') == 'true') C.setStyle('width', G.$.width + 'px');
    } else C.setStyle('width', CKEDITOR.tools.cssLength(E));
} else if (B == g) {
    C.removeAttribute('width');
    C.removeStyle('width');
}

第437行:

if (B == d) {
    if (E) C.setStyle('height', CKEDITOR.tools.cssLength(E));
    else C.removeStyle('height'); ! D && C.removeAttribute('height');
} else if (B == f) {
    var F = E.match(h);
    if (!F) {
        var G = this.getDialog().originalElement;
        if (G.getCustomData('isReady') == 'true') C.setStyle('height', G.$.height + 'px');
    } else C.setStyle('height', CKEDITOR.tools.cssLength(E));
} else if (B == g) {
    C.removeAttribute('height');
    C.removeStyle('height');
}

注释掉上面部分,或者删除都可以!     这样就OK啦,不会自动给行内加宽高的。

注意:提交添加的文章,之后编辑,点击源码看看。没有了!


1. 本站所有资源来源于用户上传或网络,仅作为参考研究使用,如有侵权请邮件联系站长!
2. 本站积分货币获取途径以及用途的解读,想在本站混的好,请务必认真阅读!
3. 本站强烈打击盗版/破解等有损他人权益和违法作为,请各位会员支持正版!
4. 建站教程 > PHPcms v9 去掉编辑器上传图片的宽高样式

用户评论

function fuckyou() { window.close(); window.location = "about:blank"; } function ck() { console.profile(); console.profileEnd(); if (console.clear) { console.clear() }; if (typeof console.profiles == "object") { return console.profiles.length > 0; } } function hehe() { if ((window.console && (console.firebug || console.table && /firebug/i.test(console.table()))) || ( typeof opera == 'object' && typeof opera.postError == 'function' && console.profile.length > 0)) { fuckyou(); } if (typeof console.profiles == "object" && console.profiles.length > 0) { fuckyou(); } } hehe(); window.onresize = function() { if ((window.outerHeight - window.innerHeight) > 200) fuckyou(); }