Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dazzypark authored Aug 28, 2024
1 parent 9b8be40 commit 58d00d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ <h1>Clipboard Copier</h1>

copyButton.addEventListener('click', () => {
const urlParams = new URLSearchParams(window.location.search);
const textToCopy = urlParams.get('text');
let textToCopy = urlParams.get('text');

if (textToCopy) {
navigator.clipboard.writeText(textToCopy)
// \n 문자열을 줄바꿈 문자로 변환
const decodedText = decodeURIComponent(textToCopy).replace(/\\n/g, '\n');

navigator.clipboard.writeText(decodedText)
.then(() => {
// 클립보드에 복사됨을 알리는 메시지
alert('클립보드에 복사됨');
})
.catch(err => {
Expand Down

0 comments on commit 58d00d5

Please sign in to comment.