Skip to content

Commit

Permalink
optimization: inputTag粘贴时换行符替换为空格
Browse files Browse the repository at this point in the history
  • Loading branch information
ywywZhou committed Nov 14, 2023
1 parent 4755f12 commit d8dc3f3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
const clp = (e.originalEvent || e).clipboardData
if (clp === undefined || clp === null) {
text = window.clipboardData.getData('text') || ''
text = text.replace(/(\n|\r|\r\n)/g, '')
text = text.replace(/(\n|\r|\r\n)/g, ' ')
if (text !== '') {
if (window.getSelection) {
const newNode = document.createElement('span')
Expand All @@ -512,7 +512,7 @@
}
} else {
text = clp.getData('text/plain') || ''
text = text.replace(/(\n|\r|\r\n)/g, '')
text = text.replace(/(\n|\r|\r\n)/g, ' ')
text && document.execCommand('insertText', false, text)
}
}
Expand Down

0 comments on commit d8dc3f3

Please sign in to comment.