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

Removed interim fix for tag field #581

Merged
merged 2 commits into from
Jul 11, 2017
Merged

Conversation

mmmavis
Copy link
Member

@mmmavis mmmavis commented Jun 20, 2017

Fixes #568


Note: confirm if we want to push for oneWord tags (no spaces) or multi-word tags (with spaces) are fine

@mmmavis mmmavis requested a review from Pomax June 20, 2017 23:54
@cadecairos cadecairos temporarily deployed to network-pulse-staging-pr-581 June 20, 2017 23:54 Inactive
@mmmavis mmmavis temporarily deployed to network-pulse-staging-pr-581 June 20, 2017 23:55 Inactive
@mmmavis mmmavis temporarily deployed to network-pulse-staging-pr-581 June 20, 2017 23:56 Inactive
@mmmavis mmmavis force-pushed the issue-568-tag-field-delimiters branch from 11af8d6 to c8ae45b Compare June 20, 2017 23:57
@@ -80,15 +51,17 @@ let Tags = React.createClass({
}).filter(suggestion => !!suggestion);
},
render: function() {
let delimiters = [9,13,32,188]; // keycodes for tab,enter,space,comma
Copy link
Contributor

@Pomax Pomax Jun 22, 2017

Choose a reason for hiding this comment

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

these are constants, so it's better if, at the top the file rather than inside render(), we say:

const TAG_DELIMITERS = ['\t', '\r', '\n', ' ', ','].map( v => v.charCodeAt(0) );

Copy link
Member Author

Choose a reason for hiding this comment

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

hey @Pomax , I found out the value returned from charCodeAt isn’t necessarily the same as the keycode returned from keyboard event. Comma is one example - it is 44 from charCodeAt but its keycode is 188. I searched it a bit but couldn't find a solution... do you know a way to convert character to keycode? If not I guess what I can do is to move that line from render() to the top of the file and make it a const.

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting point, I had a look and keyCode is apparently obsolete. I've filed this over on i-like-robots/react-tags#81 too.

To resolve this rather than charCodeAt(0) we can use codePointAt(0) which yields the correct value.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Pomax ",".codePointAt(0) returns 44 as well 👀

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah okay this is weird. Let's take out "32" for space because spaces in tags should be fine (e.g. "digital literacy"), and move it up as a const DELIMITERD = [...] and then it's R+

Pomax
Pomax previously requested changes Jun 27, 2017
@@ -80,15 +51,17 @@ let Tags = React.createClass({
}).filter(suggestion => !!suggestion);
},
render: function() {
let delimiters = [9,13,32,188]; // keycodes for tab,enter,space,comma
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah okay this is weird. Let's take out "32" for space because spaces in tags should be fine (e.g. "digital literacy"), and move it up as a const DELIMITERD = [...] and then it's R+

@mmmavis mmmavis force-pushed the issue-568-tag-field-delimiters branch from c8ae45b to 1f9caba Compare July 11, 2017 19:18
@mmmavis mmmavis dismissed Pomax’s stale review July 11, 2017 19:18

PR updated!

@mmmavis mmmavis requested a review from Pomax July 11, 2017 19:19
Copy link
Contributor

@Pomax Pomax left a comment

Choose a reason for hiding this comment

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

yarrrrr 🐰

@mmmavis
Copy link
Member Author

mmmavis commented Jul 11, 2017

🍻

@mmmavis mmmavis merged commit 3514a0b into master Jul 11, 2017
@mmmavis mmmavis deleted the issue-568-tag-field-delimiters branch July 18, 2017 17:59
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.

3 participants