Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
code improve
  • Loading branch information
jtydhr88 committed Dec 2, 2025
commit 427826a93dca255da9980b6d8d4198b8af9ffdc9
4 changes: 3 additions & 1 deletion src/composables/useCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const useCopy = () => {
const serializedData = canvas.copyToClipboard()
// Use TextEncoder to handle Unicode characters properly
const base64Data = btoa(
String.fromCharCode(...new TextEncoder().encode(serializedData))
String.fromCharCode(
...Array.from(new TextEncoder().encode(serializedData))
)
)
// clearData doesn't remove images from clipboard
e.clipboardData?.setData(
Expand Down
4 changes: 3 additions & 1 deletion tests-ui/tests/composables/clipboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { describe, expect, it } from 'vitest'
* Encodes a UTF-8 string to base64 (same logic as useCopy.ts)
*/
function encodeClipboardData(data: string): string {
return btoa(String.fromCharCode(...new TextEncoder().encode(data)))
return btoa(
String.fromCharCode(...Array.from(new TextEncoder().encode(data)))
)
}

/**
Expand Down
Loading