Skip to content

Commit

Permalink
fix: 插入链接内容错误
Browse files Browse the repository at this point in the history
  • Loading branch information
blackhu0804 committed Apr 11, 2021
1 parent ee53439 commit d2be13a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/text/event-hooks/paste-text-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ function pasteTextHtml(editor: Editor, pasteEvents: Function[]) {
pasteText = '' + (pasteTextHandle(pasteText) || '') // html
}

const insertUrl = urlRegex.exec(pasteText)![0]
const otherText = pasteText.replace(urlRegex, '')

return editor.cmd.do(
'insertHTML',
`<a href="${pasteText}" target="_blank">${pasteText}</a>`
`<a href="${insertUrl}" target="_blank">${insertUrl}</a>${otherText}`
) // html
}
// table 中(td、th),待开发。。。
Expand Down

0 comments on commit d2be13a

Please sign in to comment.