修复纯文本的拷贝

This commit is contained in:
jacky 2024-05-23 19:11:47 +08:00
parent 1af72d2bb2
commit e67b8d10b1
1 changed files with 12 additions and 1 deletions

View File

@ -81,10 +81,21 @@ const customPaste = (editor, event, callback) => {
loadingShow.value = true
let htmlData = event.clipboardData.getData('text/html') // html
// console.log(htmlData)
if (htmlData == "") {
//
htmlData = event.clipboardData.getData('text/plain') // html
// console.log(htmlData)
// \n p
htmlData.replace(/\r/g, '');
htmlData = '<p>' + htmlData.replace(/\n/g, '</p><p>') + '</p>'
//
editor.dangerouslyInsertHtml(htmlData);
loadingShow.value = false
callback(false)
event.preventDefault()
return
}
let rtfData = event.clipboardData.getData('text/rtf') // html
// console.log('-------------- rtfData --------------', rtfData)