Merge branch 'refactor-emoji-input' into 'develop'
EmojiInput refactoring Closes #565 See merge request pleroma/pleroma-fe!824
This commit is contained in:
commit
69eff65130
10 changed files with 445 additions and 299 deletions
|
@ -154,7 +154,11 @@ const getStaticEmoji = async ({ store }) => {
|
|||
if (res.ok) {
|
||||
const values = await res.json()
|
||||
const emoji = Object.keys(values).map((key) => {
|
||||
return { shortcode: key, image_url: false, 'utf': values[key] }
|
||||
return {
|
||||
displayText: key,
|
||||
imageUrl: false,
|
||||
replacement: values[key]
|
||||
}
|
||||
})
|
||||
store.dispatch('setInstanceOption', { name: 'emoji', value: emoji })
|
||||
} else {
|
||||
|
@ -175,7 +179,12 @@ const getCustomEmoji = async ({ store }) => {
|
|||
const result = await res.json()
|
||||
const values = Array.isArray(result) ? Object.assign({}, ...result) : result
|
||||
const emoji = Object.keys(values).map((key) => {
|
||||
return { shortcode: key, image_url: values[key].image_url || values[key] }
|
||||
const imageUrl = values[key].image_url
|
||||
return {
|
||||
displayText: key,
|
||||
imageUrl: imageUrl ? store.state.instance.server + imageUrl : values[key],
|
||||
replacement: `:${key}: `
|
||||
}
|
||||
})
|
||||
store.dispatch('setInstanceOption', { name: 'customEmoji', value: emoji })
|
||||
store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: true })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue