Skip to content

Commit

Permalink
Hide copy indicator after clicking elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbade committed Feb 19, 2023
1 parent 16c2d25 commit 50f4cc4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ const addMessage = (message, type) => {
})
.catch((error) => {
alert('Error copying text to clipboard:', error)
});
});
})
})

window.addEventListener('click', () => {
const oldCopiedIndicators = document.querySelectorAll('.copied-indicator')
for (const indicator of oldCopiedIndicators) {
indicator.innerText = ''
}
})
}

const addSentMessage = message => {
Expand Down

0 comments on commit 50f4cc4

Please sign in to comment.