// 配置粘贴文本的内容处理
editor.config.pasteTextHandle = function(newHtml) {
// 获取href
const re = '[a-zA-z]+://[^\\s]*'
const bb = newHtml.match(re)
// 获取标签中的文本
console.log('newHtml', newHtml)
const str = newHtml.replace(/<[^>]+>/g, '')// 截取html标签
const text = str.replace(/ /ig, '')// 截取空格等特殊标签
console.log('text', text)
// 拼接最新标签
const mergeStr = '<a href=' + '"' + bb + 'target="_blank"' + ' style="font-size:14px;"' + '>' + text + '</a>'
console.log('mergeStr', mergeStr)
newHtml = mergeStr
console.log('newHtml', newHtml)
// 对粘贴的文本进行处理,然后返回处理后的结果
return newHtml
}
处理用户粘贴到文本框的数据内容