Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
elixxir
xxdk-wasm
Commits
28f7bfb1
Commit
28f7bfb1
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Copy EmojiMartData interface emoji-mart directly to emojiMartSet
parent
0b1cb906
No related branches found
No related tags found
2 merge requests
!67
fix for latest client release
,
!61
Add emoji sanitizater
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
emoji/emojiMart.go
+23
-12
23 additions, 12 deletions
emoji/emojiMart.go
emoji/emojiMart_test.go
+3
-2
3 additions, 2 deletions
emoji/emojiMart_test.go
emoji/emojiSet.go
+1
-1
1 addition, 1 deletion
emoji/emojiSet.go
with
27 additions
and
15 deletions
emoji/emojiMart.go
+
23
−
12
View file @
28f7bfb1
...
...
@@ -19,36 +19,47 @@ type emojiID string
type
codepoint
string
// emojiMartSet is a representation of the JSON file format containing the emoji
// list in emoji-mart.
// list in emoji-mart. It matches the object EmojiMartData:
// https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-data/index.d.ts
//
// Doc: https://github.com/missive/emoji-mart/
// JSON example: https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-data/sets/14/native.json
type
emojiMartSet
struct
{
Categories
[]
category
`json:"categories"`
Emojis
map
[
emojiID
]
emoji
`json:"emojis"`
Aliases
map
[
string
]
emojiID
`json:"aliases"`
Sheet
map
[
string
]
interface
{}
`json:"sheet"`
Categories
[]
category
`json:"categories"`
Emojis
map
[
emojiID
]
emoji
`json:"emojis"`
Aliases
map
[
string
]
emojiID
`json:"aliases"`
Sheet
sheet
`json:"sheet"`
}
// category adheres to the category field of the emoji-mart JSON file.
// category adheres to the categories field within the EmojiMartData Javascript
// interface.
type
category
struct
{
Emojis
[]
emojiID
`json:"emojis"`
ID
string
`json:"id"`
Emojis
[]
emojiID
`json:"emojis"`
}
// emoji adheres to the emoji field of the emoji-mart JSON file.
// emoji adheres to the emojis field within the EmojiMartData Javascript
// interface.
type
emoji
struct
{
Emoticons
[]
string
`json:"emoticons,omitempty"`
ID
emojiID
`json:"id"`
Name
string
`json:"name"`
Keywords
[]
string
`json:"keywords"`
Skins
[]
skin
`json:"skins"`
Version
float32
`json:"version"`
Version
float64
`json:"version"`
Emoticons
[]
string
`json:"emoticons,omitempty"`
}
// skin adheres to the skin field within the emoji field of the emoji-mart JSON
// file.
// skin adheres to the skins field within the EmojiMartData Javascript interface.
type
skin
struct
{
Unified
codepoint
`json:"unified"`
Native
string
`json:"native"`
X
float64
`json:"x,omitempty"`
Y
float64
`json:"y,omitempty"`
}
// sheet adheres to the sheet field within the EmojiMartData Javascript
// interface.
type
sheet
struct
{
Cols
float64
`json:"cols"`
Rows
float64
`json:"rows"`
}
This diff is collapsed.
Click to expand it.
emoji/emojiMart_test.go
+
3
−
2
View file @
28f7bfb1
...
...
@@ -39,8 +39,9 @@ func Test_emojiMartData_JSON_Marshal_Unmarshal(t *testing.T) {
Aliases
:
map
[
string
]
emojiID
{
"lady_beetle"
:
"ladybug"
,
},
Sheet
:
map
[
string
]
interface
{}{
"test"
:
"data"
,
Sheet
:
sheet
{
Cols
:
5
,
Rows
:
12
,
},
}
...
...
This diff is collapsed.
Click to expand it.
emoji/emojiSet.go
+
1
−
1
View file @
28f7bfb1
...
...
@@ -82,7 +82,7 @@ func (s *Set) findIncompatibleEmojis(set *emojiMartSet) (emojisToRemove []emojiI
// Determine if the emoji's codepoint should be replaced or removed
replacement
,
replace
:=
s
.
replace
(
Skin
.
Unified
)
if
replace
{
jww
.
TRACE
.
Printf
(
"Replaced codepoint %q with %
q
for emoji %q"
,
jww
.
TRACE
.
Printf
(
"Replaced codepoint %q with %
v
for emoji %q"
,
Skin
.
Unified
,
replacement
,
id
)
newSkins
=
append
(
newSkins
,
replacement
)
}
else
if
!
s
.
remove
(
Skin
.
Unified
)
{
...
...
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