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 UserMentionSuggestions block #24194

Merged
merged 5 commits into from
Apr 17, 2018
Merged

Conversation

bluefuton
Copy link
Contributor

@bluefuton bluefuton commented Apr 16, 2018

Adds a new block, UserMentionSuggestions, along with a higher-order component to wrap inputs and provide @ mention suggestions inside them.

Background

We current have username suggestion for @mentions in the Editor only (implemented in #10142). This is the beginning of an effort to decouple that functionality from TinyMCE and make it usable anywhere in Calypso, including the Reader comments section and Conversations tool.

To test

Visit http://calypso.localhost:3000/devdocs/blocks/user-mention-suggestions and check your console. It doesn't do much yet :-)

screen shot 2018-04-17 at 2 53 55 pm

@bluefuton bluefuton added [Status] In Progress [Feature] Reader The reader site on Calypso. labels Apr 16, 2018
@bluefuton bluefuton added this to the Reader: Feature Backlog milestone Apr 16, 2018
@bluefuton bluefuton self-assigned this Apr 16, 2018
@matticbot
Copy link
Contributor

@bluefuton
Copy link
Contributor Author

bluefuton commented Apr 16, 2018

  • add feature flag

@bluefuton bluefuton requested review from samouri and blowery April 16, 2018 07:16
@bluefuton bluefuton force-pushed the add/block/user-mention-suggestions branch from 866e350 to bdb34af Compare April 17, 2018 02:55
@bluefuton bluefuton added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Apr 17, 2018
import ExampleInput from './example-input';
import withUserMentionSuggestions from '../with-user-mention-suggestions';

const UserMentionSuggestionsExampleInput = ( { onKeyPress } ) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we need to add an explicit displayName here for this example component too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It'll only ever be used inside UserMentionSuggestionsExample (to demonstrate how the HoC works), so should be alright without one I think.

config/test.json Outdated
@@ -84,6 +84,7 @@
"reader/full-errors": true,
"reader/list-management": false,
"reader/new-post-notifications": true,
"reader/user-mention-suggestions": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably fine to enable for testing, should you want to add component tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good shout 👍

static propTypes = {};

handleKeyPress = e => {
if ( e.target.value[ e.target.value.length - 1 ] === '@' ) {
Copy link
Contributor

@gwwar gwwar Apr 17, 2018

Choose a reason for hiding this comment

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

I realize this is a placeholder, but I would suggest adding tests later to catch our desired cases. For example would we want word@name to trigger a highlight vs word @name?

Copy link
Contributor

@gwwar gwwar left a comment

Choose a reason for hiding this comment

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

Changes here look good to me 👍

@bluefuton
Copy link
Contributor Author

Thanks for the 👀 @gwwar!

@bluefuton bluefuton merged commit 07318c0 into master Apr 17, 2018
@bluefuton bluefuton deleted the add/block/user-mention-suggestions branch April 17, 2018 23:50
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Reader The reader site on Calypso.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants