Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
pleroma-fe
Commits
1c3bdda1
Unverified
Commit
1c3bdda1
authored
2 years ago
by
tusooa
Browse files
Options
Downloads
Patches
Plain Diff
Load unicode emoji annotations
parent
d5411c9f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1711
Update stable - 2.5.0 release
,
!1408
Group emojis into packs in emoji picker
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/i18n/languages.js
+9
-1
9 additions, 1 deletion
src/i18n/languages.js
src/modules/config.js
+1
-0
1 addition, 0 deletions
src/modules/config.js
src/modules/instance.js
+24
-0
24 additions, 0 deletions
src/modules/instance.js
with
34 additions
and
1 deletion
src/i18n/languages.js
+
9
−
1
View file @
1c3bdda1
...
...
@@ -38,7 +38,15 @@ const specialJsonName = {
const
langCodeToJsonName
=
(
code
)
=>
specialJsonName
[
code
]
||
code
const
langCodeToCldrName
=
(
code
)
=>
code
const
ensureFinalFallback
=
codes
=>
{
return
codes
.
includes
(
'
en
'
)
?
codes
:
codes
.
concat
([
'
en
'
])
}
module
.
exports
=
{
languages
,
langCodeToJsonName
langCodeToJsonName
,
langCodeToCldrName
,
ensureFinalFallback
}
This diff is collapsed.
Click to expand it.
src/modules/config.js
+
1
−
0
View file @
1c3bdda1
...
...
@@ -183,6 +183,7 @@ const config = {
break
case
'
interfaceLanguage
'
:
messages
.
setLanguage
(
this
.
getters
.
i18n
,
value
)
dispatch
(
'
loadUnicodeEmojiData
'
,
value
)
Cookies
.
set
(
BACKEND_LANGUAGE_COOKIE_NAME
,
localeService
.
internalToBackendLocale
(
value
))
break
case
'
thirdColumnMode
'
:
...
...
This diff is collapsed.
Click to expand it.
src/modules/instance.js
+
24
−
0
View file @
1c3bdda1
...
...
@@ -2,6 +2,7 @@ import { getPreset, applyTheme } from '../services/style_setter/style_setter.js'
import
{
CURRENT_VERSION
}
from
'
../services/theme_data/theme_data.service.js
'
import
apiService
from
'
../services/api/api.service.js
'
import
{
instanceDefaultProperties
}
from
'
./config.js
'
import
{
langCodeToCldrName
,
ensureFinalFallback
}
from
'
../i18n/languages.js
'
const
SORTED_EMOJI_GROUP_IDS
=
[
'
smileys-and-emotion
'
,
...
...
@@ -78,6 +79,7 @@ const defaultState = {
customEmojiFetched
:
false
,
emoji
:
{},
emojiFetched
:
false
,
unicodeEmojiAnnotations
:
{},
pleromaBackend
:
true
,
postFormats
:
[],
restrictedNicknames
:
[],
...
...
@@ -109,6 +111,12 @@ const defaultState = {
}
}
const
loadAnnotations
=
(
lang
)
=>
{
return
import
(
`@kazvmoe-infra/unicode-emoji-json/annotations/
${
langCodeToCldrName
(
lang
)}
.json`
)
}
const
instance
=
{
state
:
defaultState
,
mutations
:
{
...
...
@@ -119,6 +127,9 @@ const instance = {
},
setKnownDomains
(
state
,
domains
)
{
state
.
knownDomains
=
domains
},
setUnicodeEmojiAnnotations
(
state
,
{
lang
,
annotations
})
{
state
.
unicodeEmojiAnnotations
[
lang
]
=
annotations
}
},
getters
:
{
...
...
@@ -206,6 +217,19 @@ const instance = {
}
},
loadUnicodeEmojiData
({
commit
,
state
},
language
)
{
const
langList
=
ensureFinalFallback
(
Array
.
isArray
(
language
)
?
language
:
[
language
])
return
Promise
.
all
(
langList
.
forEach
(
async
lang
=>
{
if
(
!
state
.
unicodeEmojiAnnotations
[
lang
])
{
const
annotations
=
await
loadAnnotations
(
lang
)
commit
(
'
setUnicodeEmojiAnnotations
'
,
{
lang
,
annotations
})
}
}))
},
async
getCustomEmoji
({
commit
,
state
})
{
try
{
const
res
=
await
window
.
fetch
(
'
/api/pleroma/emoji.json
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment