1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Remove leading # when creating tag

- Remove leading # from tags that are created with leading #
- Convenience method for users who tend to type them, but did not want a
tag with double #
- If a user wants a tag with a leading #, then can double it (ie: ##OfPeople)
This commit is contained in:
Andy Klimczak
2018-01-29 20:42:59 -05:00
parent 2259167200
commit 470c071344

View File

@@ -64,7 +64,8 @@ class TagSelect extends React.Component {
submitTag () {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_TAG')
let { value } = this.props
const newTag = this.refs.newTag.value.trim().replace(/ +/g, '_')
let newTag = this.refs.newTag.value.trim().replace(/ +/g, '_')
newTag = newTag.charAt(0) === '#' ? newTag.substring(1) : newTag
if (newTag.length <= 0) {
this.setState({