1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-26 16:11:45 +00:00

add saveTagsAlphabetically option

This commit is contained in:
Baptiste Augrain
2018-08-29 19:28:09 +02:00
parent 5006aaae38
commit 8b4a9dd325
6 changed files with 24 additions and 2 deletions

View File

@@ -363,6 +363,7 @@ class MarkdownNoteDetail extends React.Component {
<TagSelect
ref='tags'
value={this.state.note.tags}
saveTagsAlphabetically={config.ui.saveTagsAlphabetically}
showTagsAlphabetically={config.ui.showTagsAlphabetically}
onChange={this.handleUpdateTag.bind(this)}
/>

View File

@@ -744,6 +744,7 @@ class SnippetNoteDetail extends React.Component {
<TagSelect
ref='tags'
value={this.state.note.tags}
saveTagsAlphabetically={config.ui.saveTagsAlphabetically}
showTagsAlphabetically={config.ui.showTagsAlphabetically}
onChange={(e) => this.handleChange(e)}
/>

View File

@@ -82,8 +82,14 @@ class TagSelect extends React.Component {
value = _.isArray(value)
? value.slice()
: []
value.push(newTag)
value = _.uniq(value)
if (!_.includes(value, newTag)) {
value.push(newTag)
}
if (this.props.saveTagsAlphabetically) {
value = _.sortBy(value)
}
this.setState({
newTag: ''