Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
nexedi
converse.js
Commits
01468fc0
Commit
01468fc0
authored
Sep 05, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converse-emoji: Sort search results
Also, don't show the categories while searching.
parent
60f04bc9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
sass/_emoji.scss
sass/_emoji.scss
+4
-0
src/headless/converse-emoji.js
src/headless/converse-emoji.js
+3
-7
src/templates/emojis.html
src/templates/emojis.html
+3
-1
No files found.
sass/_emoji.scss
View file @
01468fc0
...
...
@@ -59,6 +59,10 @@
list-style
:
none
;
position
:
relative
;
&
.insert-emoji
{
margin
:
0
;
height
:
32px
;
width
:
32px
;
&
.picked
{
background-color
:
var
(
--
highlight-color
);
}
...
...
src/headless/converse-emoji.js
View file @
01468fc0
...
...
@@ -332,19 +332,15 @@ converse.plugins.add('converse-emoji', {
const
{
default
:
json
}
=
await
import
(
/*webpackChunkName: "emojis" */
'
./emojis.json
'
);
_converse
.
emojis
.
json
=
json
;
_converse
.
emojis_map
=
Object
.
keys
(
_converse
.
emojis
.
json
).
reduce
((
result
,
cat
)
=>
Object
.
assign
(
result
,
_converse
.
emojis
.
json
[
cat
]),
{});
_converse
.
emojis
.
categories
=
Object
.
keys
(
_converse
.
emojis
.
json
);
_converse
.
emojis_map
=
_converse
.
emojis
.
categories
.
reduce
((
result
,
cat
)
=>
Object
.
assign
(
result
,
_converse
.
emojis
.
json
[
cat
]),
{});
_converse
.
emojis_list
=
Object
.
values
(
_converse
.
emojis_map
);
_converse
.
emojis_list
.
sort
((
a
,
b
)
=>
a
.
sn
<
b
.
sn
?
-
1
:
(
a
.
sn
>
b
.
sn
?
1
:
0
));
_converse
.
emoji_shortnames
=
_converse
.
emojis_list
.
map
(
m
=>
m
.
sn
);
_converse
.
emoji_shortnames
.
sort
();
const
getShortNames
=
()
=>
_converse
.
emoji_shortnames
.
map
(
s
=>
s
.
replace
(
/
[
+
]
/g
,
"
\\
$&
"
)).
join
(
'
|
'
);
_converse
.
emojis
.
shortnames_regex
=
new
RegExp
(
"
<object[^>]*>.*?<
\
/object>|<span[^>]*>.*?<
\
/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(
"
+
getShortNames
()
+
"
)
"
,
"
gi
"
);
const
excluded_categories
=
[
'
modifier
'
,
'
regional
'
];
_converse
.
emojis
.
all_categories
=
_converse
.
emojis_list
.
map
(
e
=>
e
.
c
)
.
filter
((
c
,
i
,
arr
)
=>
arr
.
indexOf
(
c
)
==
i
)
.
filter
(
c
=>
!
excluded_categories
.
includes
(
c
));
_converse
.
emojis
.
toned
=
getTonedEmojis
();
...
...
src/templates/emojis.html
View file @
01468fc0
<div
class=
"emoji-picker__container"
>
<div
class=
"emoji-picker__header"
>
<input
class=
"form-control emoji-search"
name=
"emoji-search"
placeholder=
"{{{o.__('Search')}}}"
/>
{[ if (!o.query) { ]}
<ul>
{[ Object.keys(o.emoji_categories).forEach(function (category) { ]}
<li
data-category=
"{{{category}}}"
class=
"emoji-category
{[ if (o.current_category === category) { ]} picked {[ } ]}"
title=
"{{{o._converse.emoji_category_labels[category]}}}"
>
<li
data-category=
"{{{category}}}"
class=
"emoji-category {{{o.current_category}}} {{{ category}}}
{[ if (o.current_category === category) { ]} picked {[ } ]}"
title=
"{{{o._converse.emoji_category_labels[category]}}}"
>
<a
class=
"pick-category"
href=
"#emoji-picker-{{{category}}}"
data-category=
"{{{category}}}"
>
{{ o.transformCategory(o.emoji_categories[category]) }}
</a>
</li>
{[ }); ]}
</ul>
{[ } ]}
</div>
<div
class=
"emoji-picker__lists"
>
{[ if (o.query) { ]}
...
...
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