Custom channel emoticons WIP (#130)
This commit is contained in:
@ -119,7 +119,7 @@ function defaultConverseParams (
|
||||
params.emoji_categories = Object.assign(
|
||||
{},
|
||||
customEmojisUrl
|
||||
? { custom: ':xmpp:' } // TODO: put here the default custom emoji
|
||||
? { custom: ':converse:' }
|
||||
: {},
|
||||
{
|
||||
smileys: ':grinning:',
|
||||
|
@ -33,8 +33,10 @@ export const livechatEmojisPlugin = {
|
||||
return json
|
||||
}
|
||||
|
||||
// We will put default emojis at the end
|
||||
// We will put default emojis at the end, so keeping a copy
|
||||
const defaultCustom = json.custom ?? {}
|
||||
// Now we must clone json, to avoid side effects when navigating between several videos.
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
json.custom = {}
|
||||
|
||||
let defaultDef: CustomEmojiDefinition | undefined
|
||||
@ -48,6 +50,15 @@ export const livechatEmojisPlugin = {
|
||||
if (def.isCategoryEmoji) {
|
||||
defaultDef ??= def
|
||||
}
|
||||
|
||||
// We must also remove any existing emojis in category other than custom
|
||||
for (const type of Object.keys(json)) {
|
||||
const v: {[key: string]: any} = json[type]
|
||||
if (type !== 'custom' && type !== 'modifiers' && (def.sn in v)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete v[def.sn]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const key in defaultCustom) {
|
||||
|
Reference in New Issue
Block a user