Revert skin tone emoji on search code
parent
9afc613fee
commit
ed241d1d42
|
@ -522,7 +522,6 @@ export default class NimblePicker extends React.PureComponent {
|
||||||
ref={this.setSearchRef}
|
ref={this.setSearchRef}
|
||||||
onSearch={this.handleSearch}
|
onSearch={this.handleSearch}
|
||||||
data={this.data}
|
data={this.data}
|
||||||
set={set}
|
|
||||||
i18n={this.i18n}
|
i18n={this.i18n}
|
||||||
emojisToShowFilter={emojisToShowFilter}
|
emojisToShowFilter={emojisToShowFilter}
|
||||||
include={include}
|
include={include}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default class Search extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data = props.data
|
this.data = props.data
|
||||||
this.emojiIndex = new NimbleEmojiIndex(this.data, props.set)
|
this.emojiIndex = new NimbleEmojiIndex(this.data)
|
||||||
this.setRef = this.setRef.bind(this)
|
this.setRef = this.setRef.bind(this)
|
||||||
this.clear = this.clear.bind(this)
|
this.clear = this.clear.bind(this)
|
||||||
this.handleKeyUp = this.handleKeyUp.bind(this)
|
this.handleKeyUp = this.handleKeyUp.bind(this)
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
import { getData, getSanitizedData, intersect } from '..'
|
import { getData, getSanitizedData, intersect } from '..'
|
||||||
import { uncompress } from '../data'
|
import { uncompress } from '../data'
|
||||||
import store from '../store'
|
|
||||||
|
|
||||||
export default class NimbleEmojiIndex {
|
export default class NimbleEmojiIndex {
|
||||||
constructor(data, set) {
|
constructor(data) {
|
||||||
if (data.compressed) {
|
if (data.compressed) {
|
||||||
uncompress(data)
|
uncompress(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data = data || {}
|
this.data = data || {}
|
||||||
this.set = set || null
|
|
||||||
this.originalPool = {}
|
this.originalPool = {}
|
||||||
this.index = {}
|
this.index = {}
|
||||||
this.emojis = {}
|
this.emojis = {}
|
||||||
|
@ -22,7 +20,7 @@ export default class NimbleEmojiIndex {
|
||||||
buildIndex() {
|
buildIndex() {
|
||||||
for (let emoji in this.data.emojis) {
|
for (let emoji in this.data.emojis) {
|
||||||
let emojiData = this.data.emojis[emoji],
|
let emojiData = this.data.emojis[emoji],
|
||||||
{ short_names, emoticons, skin_variations } = emojiData,
|
{ short_names, emoticons } = emojiData,
|
||||||
id = short_names[0]
|
id = short_names[0]
|
||||||
|
|
||||||
if (emoticons) {
|
if (emoticons) {
|
||||||
|
@ -35,16 +33,7 @@ export default class NimbleEmojiIndex {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// If skin variations include them
|
this.emojis[id] = getSanitizedData(id, null, null, this.data)
|
||||||
if (skin_variations) {
|
|
||||||
this.emojis[id] = {}
|
|
||||||
for (let skinTone = 1; skinTone <= 6; skinTone++) {
|
|
||||||
this.emojis[id][skinTone] = getSanitizedData({id: id, skin: skinTone}, skinTone, this.set, this.data)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.emojis[id] = getSanitizedData(id, null, this.set, this.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.originalPool[id] = emojiData
|
this.originalPool[id] = emojiData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +70,6 @@ export default class NimbleEmojiIndex {
|
||||||
if (this.customEmojisList != custom)
|
if (this.customEmojisList != custom)
|
||||||
this.addCustomToPool(custom, this.originalPool)
|
this.addCustomToPool(custom, this.originalPool)
|
||||||
|
|
||||||
const skinTone = store.get('skin') || 1;
|
|
||||||
|
|
||||||
maxResults || (maxResults = 75)
|
maxResults || (maxResults = 75)
|
||||||
include || (include = [])
|
include || (include = [])
|
||||||
exclude || (exclude = [])
|
exclude || (exclude = [])
|
||||||
|
@ -92,7 +79,7 @@ export default class NimbleEmojiIndex {
|
||||||
|
|
||||||
if (value.length) {
|
if (value.length) {
|
||||||
if (value == '-' || value == '-1') {
|
if (value == '-' || value == '-1') {
|
||||||
return [this.emojis['-1'][skinTone]]
|
return [this.emojis['-1']]
|
||||||
}
|
}
|
||||||
|
|
||||||
var values = value.toLowerCase().split(/[\s|,|\-|_]+/),
|
var values = value.toLowerCase().split(/[\s|,|\-|_]+/),
|
||||||
|
@ -161,11 +148,7 @@ export default class NimbleEmojiIndex {
|
||||||
let score = subIndex + 1
|
let score = subIndex + 1
|
||||||
if (sub == id) score = 0
|
if (sub == id) score = 0
|
||||||
|
|
||||||
if (this.emojis[id] && this.emojis[id][skinTone]) {
|
aIndex.results.push(this.emojis[id])
|
||||||
aIndex.results.push(this.emojis[id][skinTone])
|
|
||||||
} else {
|
|
||||||
aIndex.results.push(this.emojis[id])
|
|
||||||
}
|
|
||||||
aIndex.pool[id] = emoji
|
aIndex.pool[id] = emoji
|
||||||
|
|
||||||
scores[id] = score
|
scores[id] = score
|
||||||
|
|
Loading…
Reference in New Issue