-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duplicate copy warning alert #230
Fix duplicate copy warning alert #230
Conversation
@@ -14,11 +14,13 @@ import supersub from 'remark-supersub' | |||
interface Props { | |||
answer: AskResponse; | |||
onCitationClicked: (citedDocument: Citation) => void; | |||
index: Number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index: Number; | |
index: number; |
@@ -57,15 +59,16 @@ export const Answer = ({ | |||
const handleCopy = () => { | |||
alert("Please consider where you paste this content."); | |||
}; | |||
document.addEventListener("copy", handleCopy); | |||
var messageBox = document.getElementById("message-" + index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var messageBox = document.getElementById("message-" + index); | |
const messageBox = document.getElementById("message-" + index); |
@@ -57,15 +59,16 @@ export const Answer = ({ | |||
const handleCopy = () => { | |||
alert("Please consider where you paste this content."); | |||
}; | |||
document.addEventListener("copy", handleCopy); | |||
var messageBox = document.getElementById("message-" + index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe define "message-" + index
as a variable then use it in both places
Also can use a template string
- It was being added to the whole page everytime an answer was returned - This meant that if **any** content on the page was copied the alert was being shown multiple times based on how many answers there had been - This change will mean the alert will now only be shown when an answer is copied and only once Required by Azure-Samples#215
5197f25
to
384833a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
* Fix duplicate copy warning alert - It was being added to the whole page everytime an answer was returned - This meant that if **any** content on the page was copied the alert was being shown multiple times based on how many answers there had been - This change will mean the alert will now only be shown when an answer is copied and only once Required by Azure-Samples#215 * Address review comments
Purpose
Required by #215
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid
Other Information