百度富文本上传图片后样式崩塌

🔥博客主页破浪前进

🔖系列专栏VueReactPHP

❤️感谢大家点赞👍收藏⭐评论✍️


问题描述:上传图片后,图片会变得很大,当点击的时候更是会顶开整个的容器的高跟宽

原因:百度富文本为了呈现给用户良好的使用导致没有写死宽高,本地多大上传后就是多大

解决方法:在同时修改两个文件分别在

javascript 复制代码
loader.setAttribute('width','100%');//图片宽度100%
loader.setAttribute('height','auto');//图片高度auto

23774行(不一定)和24533(不一定),不行就搜索

javascript 复制代码
		loadingHtml = '<img class="loadingclass" id="' + loadingId + '" src="' +
                me.options.themePath + me.options.theme +
                '/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >';
            successHandler = function(data) {
                var link = urlPrefix + data.url,
                    loader = me.document.getElementById(loadingId);
                if (loader) {
                    loader.setAttribute('src', link);
                    loader.setAttribute('_src', link);
                    loader.setAttribute('title', data.title || '');
                    loader.setAttribute('alt', data.original || '');
                    loader.setAttribute('width','100%');//图片宽度100%
  				loader.setAttribute('height','auto');//图片高度auto
                    loader.removeAttribute('id');
                    domUtils.removeClasses(loader, 'loadingclass');
                }
            };
javascript 复制代码
					if(json.state == 'SUCCESS' && json.url) {
                            loader = me.document.getElementById(loadingId);
                            loader.setAttribute('src', link);
                            loader.setAttribute('_src', link);
                            loader.setAttribute('title', json.title || '');
                            loader.setAttribute('alt', json.original || '');
                            loader.setAttribute('width','100%');//图片宽度100%
  						loader.setAttribute('height','auto');//图片高度auto
                            loader.removeAttribute('id');
                            domUtils.removeClasses(loader, 'loadingclass');
                        } else {
                            showErrorLoader && showErrorLoader(json.state);
                        }
相关推荐
zhensherlock1 分钟前
Protocol Launcher 系列:Pika 取色器的协议控制(上篇)
前端·javascript·macos·typescript·github·mac·view design
蚂蚁家的砖2 分钟前
基于 Vue 3 + Cesium 的 DJI 无人机航线规划系统技术实践
前端·无人机
inksci3 分钟前
推荐动态群聊二维码制作工具
前端·javascript·微信小程序
wuhen_n4 分钟前
Vue3 单元测试实战:从组合式函数到组件
前端·javascript·vue.js
郑州光合科技余经理2 小时前
海外O2O系统源码剖析:多语言、多货币架构设计与二次开发实践
java·开发语言·前端·小程序·系统架构·uni-app·php
arvin_xiaoting7 小时前
OpenClaw学习总结_I_核心架构_8:SessionPruning详解
前端·chrome·学习·系统架构·ai agent·openclaw·sessionpruning
工程师老罗8 小时前
Image(图像)的用法
java·前端·javascript
swipe9 小时前
把 JavaScript 原型讲透:从 `[[Prototype]]`、`prototype` 到 `constructor` 的完整心智模型
前端·javascript·面试
问道飞鱼9 小时前
【前端知识】React 组件生命周期:从底层原理到实践场景
前端·react.js·前端框架·生命周期
CHU72903510 小时前
定制专属美丽时刻:美容预约商城小程序的贴心设计
前端·小程序