ueditor關閉word轉存功能,取消貼上時自動把word圖片替換為佔位符
阿新 • • 發佈:2019-02-16
開啟ueditor.all.js查詢wordimage
找到如下程式碼
註釋掉裡面的替換操作,就是把以上程式碼改為下面的///import core ///commands 本地圖片引導上傳 ///commandsName WordImage ///commandsTitle 本地圖片引導上傳 ///commandsDialog dialogs\wordimage UE.plugins["wordimage"] = function () { var me = this, images; me.addInputRule(function (root) { utils.each(root.getNodesByTagName('img'), function (img) { var attrs = img.attrs, flag = parseInt(attrs.width) < 128 || parseInt(attrs.height) < 43, opt = me.options, src = opt.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif'; if (attrs['_src'] && attrs['_src'].indexOf("file:///")!==-1) { img.setAttr({ width:attrs.width, height:attrs.height, alt:attrs.alt, word_img:attrs._src, src:src, _src:src, 'style':'background:url(' + ( flag ? opt.themePath + opt.theme + '/images/word.gif' : opt.langPath + opt.lang + '/images/localimage.png') + ') no-repeat center center;border:1px solid #ddd' // }) // } }) });
我自己就是這樣註釋的,發現可以用。記錄一下。///import core ///commands 本地圖片引導上傳 ///commandsName WordImage ///commandsTitle 本地圖片引導上傳 ///commandsDialog dialogs\wordimage UE.plugins["wordimage"] = function () { var me = this, images; me.addInputRule(function (root) { utils.each(root.getNodesByTagName('img'), function (img) { // var attrs = img.attrs, // flag = parseInt(attrs.width) < 128 || parseInt(attrs.height) < 43, // opt = me.options, // src = opt.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif'; // if (attrs['_src'] && attrs['_src'].indexOf("file:///")!==-1) { // img.setAttr({ // width:attrs.width, // height:attrs.height, // alt:attrs.alt, // word_img:attrs._src, // src:src, // _src:src, // 'style':'background:url(' + ( flag ? opt.themePath + opt.theme + '/images/word.gif' : opt.langPath + opt.lang + '/images/localimage.png') + ') no-repeat center center;border:1px solid #ddd' // }) // } }) });
如果你專案裡引用的是ueditor.all.min.js,那就把裡面對應的內容修改一下就好了。