-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add a reply button in non-game chats. #17214
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
Conversation
ui/chat/src/discussion.ts
Outdated
| const newVal = prefix + chatInput.value; | ||
| chatInput.focus(); | ||
| chatInput.select(); | ||
| if (!document.execCommand('insertText', false, newVal)) { |
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.
document.execCommand is deprecated
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.
There are a few alternatives but none are fully ideal (since there's no direct replacement yet for execCommand):
- Just use the code I have inside that if block. The only problem is if the user then does ctrl+z, the '@username' won't be removed.
- Use a third party library (instead of
execCommand) to mimic user input so that the '@username' is included in the browser's ctrl+z stack.
…to reply-button
if you click reply on userA, then userB, then userA again, then userA would be mentioned twice
ui/chat/src/discussion.ts
Outdated
| const newVal = prefix + chatInput.value; | ||
| if (!chatInput.value.startsWith(prefix)) chatInput.value = prefix + chatInput.value; | ||
| chatInput.focus(); | ||
| chatInput.select(); |
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.
not sure what that was for? didn't seem useful to me to have the entire input text selected.
I might be missing something
instead, guess the username from the link in the chat line
Closes #12425.