Skip to content

Commit

Permalink
fix: 复制单张图片无效
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin-yh committed Oct 13, 2021
1 parent feac0af commit 698c013
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/text/event-hooks/paste-text-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ function pasteTextHtml(editor: Editor, pasteEvents: Function[]) {
$topElem.remove()
}
} else {
editor.cmd.do('insertHTML', html)

// 如果用户从百度等网站点击复制得到的图片是一串img标签且待src的http地址
// 见 https://github.com/wangeditor-team/wangEditor/issues/3119
// 如果是走用户定义的图片上传逻辑
const isHasOnlyImgEleReg = /^<img [^>]*src=['"]([^'"]+)[^>]*>$/g
if (!isHasOnlyImgEleReg.test(html)) {
editor.cmd.do('insertHTML', html)
}
// const isHasOnlyImgEleReg = /^<img [^>]*src=['"]([^'"]+)[^>]*>$/g
// if (!isHasOnlyImgEleReg.test(html)) {
// editor.cmd.do('insertHTML', html)
// }
}
}
} catch (ex) {
Expand Down

0 comments on commit 698c013

Please sign in to comment.