1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 10:46:32 +00:00

filtering out the note's tags

This commit is contained in:
Baptiste Augrain
2018-08-25 18:22:40 +02:00
parent f195e87568
commit 53923c9c87

View File

@@ -21,10 +21,11 @@ class TagSelect extends React.Component {
this.value = this.props.value this.value = this.props.value
ee.on('editor:add-tag', this.addtagHandler) ee.on('editor:add-tag', this.addtagHandler)
const awesomplete = new Awesomplete(this.refs.newTag, { this.awesomplete = new Awesomplete(this.refs.newTag, {
minChars: 1, minChars: 1,
autoFirst: true, autoFirst: true,
list: '#datalist' list: '#datalist',
filter: (text, input) => !_.includes(this.value, text.value) && Awesomplete.FILTER_CONTAINS(text, input)
}) })
} }
@@ -34,6 +35,8 @@ class TagSelect extends React.Component {
componentWillUnmount () { componentWillUnmount () {
ee.off('editor:add-tag', this.addtagHandler) ee.off('editor:add-tag', this.addtagHandler)
this.awesomplete.destroy()
} }
handleAddTag () { handleAddTag () {