Skip to content

Commit

Permalink
Fix paste with \r chars
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Apr 2, 2021
1 parent f2e8e48 commit a85bcb1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codejar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,10 @@ export function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement, pos?: P

function handlePaste(event: ClipboardEvent) {
preventDefault(event)
const text = ((event as any).originalEvent || event).clipboardData.getData('text/plain')
const text = ((event as any).originalEvent || event)
.clipboardData
.getData('text/plain')
.replace(/\r/g, '')
const pos = save()
insert(text)
highlight(editor)
Expand Down

0 comments on commit a85bcb1

Please sign in to comment.