sforkowany z mirror/soapbox
Merge branch 'emoji-pool-fix' into 'develop'
Populate emojis in autosuggest again See merge request soapbox-pub/soapbox-fe!535datepicker-css
commit
ceee6ad755
|
@ -38,7 +38,7 @@ function clearCustomEmojis(pool) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCustomToPool(custom, pool) {
|
export function addCustomToPool(custom, pool = originalPool) {
|
||||||
if (customEmojisList.length) clearCustomEmojis(pool);
|
if (customEmojisList.length) clearCustomEmojis(pool);
|
||||||
|
|
||||||
custom.forEach((emoji) => {
|
custom.forEach((emoji) => {
|
||||||
|
@ -54,7 +54,7 @@ function addCustomToPool(custom, pool) {
|
||||||
index = {};
|
index = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) {
|
export function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) {
|
||||||
if (custom !== undefined) {
|
if (custom !== undefined) {
|
||||||
if (customEmojisList !== custom)
|
if (customEmojisList !== custom)
|
||||||
addCustomToPool(custom, originalPool);
|
addCustomToPool(custom, originalPool);
|
||||||
|
@ -181,5 +181,3 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude, custo
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { search };
|
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
import { List as ImmutableList, fromJS } from 'immutable';
|
import { List as ImmutableList, fromJS } from 'immutable';
|
||||||
import { CUSTOM_EMOJIS_FETCH_SUCCESS } from '../actions/custom_emojis';
|
import { CUSTOM_EMOJIS_FETCH_SUCCESS } from '../actions/custom_emojis';
|
||||||
|
import { addCustomToPool } from 'soapbox/features/emoji/emoji_mart_search_light';
|
||||||
|
import { buildCustomEmojis } from '../features/emoji/emoji';
|
||||||
import { emojis as emojiData } from 'soapbox/features/emoji/emoji_mart_data_light';
|
import { emojis as emojiData } from 'soapbox/features/emoji/emoji_mart_data_light';
|
||||||
|
|
||||||
const initialState = ImmutableList();
|
const initialState = ImmutableList();
|
||||||
|
|
||||||
const importEmojis = (state, emojis) => {
|
// Populate custom emojis for composer autosuggest
|
||||||
return fromJS(emojis).filter(emoji => {
|
const autosuggestPopulate = emojis => {
|
||||||
|
addCustomToPool(buildCustomEmojis(emojis));
|
||||||
|
};
|
||||||
|
|
||||||
|
const importEmojis = (state, customEmojis) => {
|
||||||
|
const emojis = fromJS(customEmojis).filter(emoji => {
|
||||||
// If a custom emoji has the shortcode of a Unicode emoji, skip it.
|
// If a custom emoji has the shortcode of a Unicode emoji, skip it.
|
||||||
// Otherwise it breaks EmojiMart.
|
// Otherwise it breaks EmojiMart.
|
||||||
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/610
|
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/610
|
||||||
const shortcode = emoji.get('shortcode', '').toLowerCase();
|
const shortcode = emoji.get('shortcode', '').toLowerCase();
|
||||||
return !emojiData[shortcode];
|
return !emojiData[shortcode];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
autosuggestPopulate(emojis);
|
||||||
|
return emojis;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function custom_emojis(state = initialState, action) {
|
export default function custom_emojis(state = initialState, action) {
|
||||||
|
|
Ładowanie…
Reference in New Issue