Explorar o código

图片格式判断

wangziqian %!s(int64=5) %!d(string=hai) anos
pai
achega
fa3f9f50b5
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/utils/handleTinymce.js

+ 2 - 2
src/utils/handleTinymce.js

@@ -74,10 +74,10 @@ export function updateFile(file) { // 上传图片
 export async function setNewHtmlString(fileList, nowHandleText) { // 更换图片地址
 export async function setNewHtmlString(fileList, nowHandleText) { // 更换图片地址
   const reg = /<img.*?(?:>|\/>)/gi
   const reg = /<img.*?(?:>|\/>)/gi
   nowHandleText = nowHandleText.replace(reg, function(match, ...rest) {
   nowHandleText = nowHandleText.replace(reg, function(match, ...rest) {
-    if (rest[1].indexOf('base64') > 0) {
+    if (match.indexOf('base64') > 0) {
       return fileList.shift()
       return fileList.shift()
     } else {
     } else {
-      return rest[1]
+      return match
     }
     }
   })
   })
   return nowHandleText
   return nowHandleText