Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
73c5c001
Commit
73c5c001
authored
Jun 24, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move emojiAlias logic into helper module
parent
a7b603a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+6
-16
app/assets/javascripts/emoji/index.js
app/assets/javascripts/emoji/index.js
+11
-0
No files found.
app/assets/javascripts/awards_handler.js
View file @
73c5c001
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
glEmojiTag
}
from
'
./behaviors/gl_emoji
'
;
import
{
glEmojiTag
}
from
'
./behaviors/gl_emoji
'
;
import
{
emojiMap
,
emojiAliase
s
,
isEmojiNameValid
,
normalizeEmojiName
}
from
'
./emoji
'
;
import
{
emojiMap
,
filterEmojiNamesByAlia
s
,
isEmojiNameValid
,
normalizeEmojiName
}
from
'
./emoji
'
;
const
animationEndEventString
=
'
animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd
'
;
const
animationEndEventString
=
'
animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd
'
;
const
transitionEndEventString
=
'
transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd
'
;
const
transitionEndEventString
=
'
transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd
'
;
...
@@ -511,21 +511,11 @@ export default class AwardsHandler {
...
@@ -511,21 +511,11 @@ export default class AwardsHandler {
}
}
}
}
findMatchingEmojiElements
(
term
)
{
findMatchingEmojiElements
(
query
)
{
const
safeTerm
=
term
.
toLowerCase
();
const
emojiMatches
=
filterEmojiNamesByAlias
(
query
);
const
$emojiElements
=
$
(
'
.emoji-menu-list:not(.frequent-emojis) [data-name]
'
);
const
namesMatchingAlias
=
[];
const
$matchingElements
=
$emojiElements
Object
.
keys
(
emojiAliases
).
forEach
((
alias
)
=>
{
.
filter
((
i
,
elm
)
=>
emojiMatches
.
indexOf
(
elm
.
dataset
.
name
)
>=
0
);
if
(
alias
.
indexOf
(
safeTerm
)
>=
0
)
{
namesMatchingAlias
.
push
(
emojiAliases
[
alias
]);
}
});
const
$matchingElements
=
namesMatchingAlias
.
concat
(
safeTerm
)
.
reduce
(
(
$result
,
searchTerm
)
=>
$result
.
add
(
$
(
`.emoji-menu-list:not(.frequent-emojis) [data-name*="
${
searchTerm
}
"]`
)),
$
([]),
);
return
$matchingElements
.
closest
(
'
li
'
).
clone
();
return
$matchingElements
.
closest
(
'
li
'
).
clone
();
}
}
...
...
app/assets/javascripts/emoji/index.js
View file @
73c5c001
...
@@ -13,10 +13,21 @@ function isEmojiNameValid(name) {
...
@@ -13,10 +13,21 @@ function isEmojiNameValid(name) {
return
validEmojiNames
.
indexOf
(
name
)
>=
0
;
return
validEmojiNames
.
indexOf
(
name
)
>=
0
;
}
}
function
filterEmojiNames
(
filter
)
{
const
match
=
filter
.
toLowerCase
();
return
validEmojiNames
.
filter
(
name
=>
name
.
indexOf
(
match
)
>=
0
);
}
function
filterEmojiNamesByAlias
(
filter
)
{
return
_
.
uniq
(
filterEmojiNames
(
filter
).
map
(
name
=>
normalizeEmojiName
(
name
)));
}
export
{
export
{
emojiMap
,
emojiMap
,
emojiAliases
,
emojiAliases
,
normalizeEmojiName
,
normalizeEmojiName
,
filterEmojiNames
,
filterEmojiNamesByAlias
,
getUnicodeSupportMap
,
getUnicodeSupportMap
,
isEmojiNameValid
,
isEmojiNameValid
,
isEmojiUnicodeSupported
,
isEmojiUnicodeSupported
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment