Skip to content
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

Add support for mention feature #2982

Merged
merged 319 commits into from
May 5, 2023
Merged

Conversation

emlynmac
Copy link
Member

@emlynmac emlynmac commented Apr 25, 2023

What

Adds support for @mention tagging in the chat components

Why

Customer request to add this functionality.

How Tested

Storybook; ad-hoc

Process & policy checklist

  • I have updated the project documentation to reflect my changes if necessary.
  • I have read the CONTRIBUTING documentation.

Is this a breaking change?

  • This change causes current functionality to break.

…zure/communication-ui-library into emlyn/mention-feature-branch-html-edit
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

emlynmac and others added 2 commits May 5, 2023 11:38
Co-authored-by: Porter Nan <jiangnanhello@live.com>
Signed-off-by: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

Failed to pass the Static HTML UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

Failed to pass the UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

@@ -53,8 +62,8 @@ type InputBoxComponentProps = {
inlineChildren: boolean;
'data-ui-id'?: string;
id?: string;
textValue: string;
onChange: (event: FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string | undefined) => void;
textValue: string; // This could be plain text or HTML.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone intentionally type a text like this:

Hello, today I wanna read book of <Learning C++>

Does the logic strong enough to hold this case

@@ -53,8 +62,8 @@ type InputBoxComponentProps = {
inlineChildren: boolean;
'data-ui-id'?: string;
id?: string;
textValue: string;
onChange: (event: FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string | undefined) => void;
textValue: string; // This could be plain text or HTML.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or.. Someone just paste a piece of html code (assuming they are developers chatting using our chat UI)

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

<Stack
className={mergeStyles(
sendBoxWrapperStyles,
{ overflow: 'visible' } // This is needed for the mention popup to be visible
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be happening if the content of senboxWrapper has real content overflow? Like too many line of text in the box?

Copy link
Member

@PorterNan PorterNan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a huge PR and a huge feature! Thanks for addressing comments and I am going to spend some time playing it in storybook ;D

@emlynmac emlynmac merged commit fcc5fd2 into main May 5, 2023
29 checks passed
@emlynmac emlynmac deleted the emlyn/mention-feature-branch-html-edit branch May 5, 2023 20:50
(ev: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
// Uses KeyCode 229 and which code 229 to determine if the press of the enter key is from a composition session or not (Safari only)
if (ev.nativeEvent.isComposing || ev.nativeEvent.keyCode === 229 || ev.nativeEvent.which === 229) {
return;
}
if (ev.key === 'ArrowUp') {
ev.preventDefault();
/* @conditional-compile-remove(mention) */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the key.preventDefault for ArrowUp and ArrowDown inherit from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants