uni-app uni-admin vue3 中使用uni-cms 修改记录出现quill Overwriting modules/ImageResize with function t(e)提示
uni-app uni-admin vue3 中使用uni-cms 修改记录出现quill Overwriting modules/ImageResize with function t(e)提示
操作步骤:
- uin-cms 添加修改文档时提示以上警告
预期结果:
- 无警告
实际结果:
- 出现警告
quill Overwriting modules/ImageResize with function t(e)
bug描述:
uni-admin vue3 中使用uni-cms 修改记录出现下面的提示:
quill Overwriting modules/ImageResize with function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,t),this.initializeModules=function(){n.removeModules(),n.modules=n.moduleClasses.map(function(t){return new(f[t]||t)(n)}),n.modules.forEach(function(t){t.onCreate()}),n.onUpdate()},this.onUpdate=function(){n.repositionElements(),n.modules.forEach(function(t){t.onUpdate()})},this.removeModules=function(){n.modules.forEach(function(t){t.onDestroy()}),n.modules=[]},this.handleClick=function(t){if(t.target&&t.target.tagName&&"IMG"===t.target.tagName.toUpperCase()){if(n.img===t.target)return;n.img&&n.hide(),n.show(t.target)}else n.img&&n.hide()},this.show=function(t){n.img=t,n.showOverlay(),n.initializeModules()},this.showOverlay=function(){n.overlay&&n.hideOverlay(),n.quill.setSelection(null),n.setUserSelect("none"),document.addEventListener("keyup",n.checkImage,!0),n.quill.root.addEventListener("input",n.checkImage,!0),n.overlay=document.createElement("div"),n.overlay.classList.add("ql-image-overlay"),n.quill.root.parentNode.appendChild(n.overlay),n.repositionElements()},this.hideOverlay=function(){n.overlay&&(n.quill.root.parentNode.removeChild(n.overlay),n.overlay=void 0,document.removeEventListener("keyup",n.checkImage),n.quill.root.removeEventListener("input",n.checkImage),n.setUserSelect(""))},this.repositionElements=function(){if(n.overlay&&n.img){var t=n.quill.root.parentNode,e=n.img.getBoundingClientRect(),o=t.getBoundingClientRect();Object.assign(n.overlay.style,{left:e.left-o.left-1+t.scrollLeft+"px",top:e.top-o.top+t.scrollTop+"px",width:e.width+"px",height:e.height+"px"})}},this.hide=function(){n.hideOverlay(),n.removeModules(),n.img=void 0},this.setUserSelect=function(t){["userSelect","mozUserSelect","webkitUserSelect","msUserSelect"].forEach(function(e){n.quill.root.style[e]=t,document.documentElement.style[e]=t})},this.checkImage=function(t){n.img&&(46!=t.keyCode&&8!=t.keyCode||window.Quill.find(n.img).deleteAt(0),n.hide())},this.quill=e;var c=!1;r.modules&&(c=r.modules.slice()),this.options=i()({},r,u.a),!1!==c&&(this.options.modules=c),document.execCommand("enableObjectResizing",!1,"false"),this.quill.root.addEventListener("click",this.handleClick,!1),this.quill.root.parentNode.style.position=this.quill.root.parentNode.style.position||"relative",this.moduleClasses=this.options.modules,this.modules=[]}
更多关于uni-app uni-admin vue3 中使用uni-cms 修改记录出现quill Overwriting modules/ImageResize with function t(e)提示的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
quill.js 版本有修改过吗?
更多关于uni-app uni-admin vue3 中使用uni-cms 修改记录出现quill Overwriting modules/ImageResize with function t(e)提示的实战教程也可以访问 https://www.itying.com/category-93-b0.html
这个警告是Quill富文本编辑器在初始化时出现的,表明ImageResize模块被重复加载或覆盖了。在uni-cms中使用quill时,这是常见但无害的警告。
解决方案:
- 检查是否重复引入了quill-image-resize模块
- 在uni-cms配置中确认只初始化了一次ImageResize模块
对于uni-admin vue3项目,可以尝试在main.js中这样处理:
import { Quill } from 'quill'
Quill.debug('error') // 将quill的debug级别设为error,忽略警告