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
9825d6e7
Commit
9825d6e7
authored
Mar 09, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bootstrap dropdown to render the emoji picker
parent
8bddd0d7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
77 deletions
+60
-77
css/converse.css
css/converse.css
+12
-5
css/inverse.css
css/inverse.css
+12
-5
sass/_chatbox.scss
sass/_chatbox.scss
+15
-4
src/converse-chatview.js
src/converse-chatview.js
+13
-54
src/converse-core.js
src/converse-core.js
+1
-0
src/templates/chatroom_toolbar.html
src/templates/chatroom_toolbar.html
+2
-6
src/templates/emojis.html
src/templates/emojis.html
+2
-0
src/templates/toolbar.html
src/templates/toolbar.html
+2
-3
src/utils.js
src/utils.js
+1
-0
No files found.
css/converse.css
View file @
9825d6e7
...
...
@@ -5227,12 +5227,14 @@ body.reset {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
{
background-color
:
#fff
;
bottom
:
100%
;
bottom
:
2rem
;
box-shadow
:
-1px
-1px
2px
0
rgba
(
0
,
0
,
0
,
0.4
);
font-size
:
12px
;
m
argin
:
0
;
margin-bottom
:
0
;
m
in-width
:
20rem
;
position
:
absolute
;
right
:
0
;
}
right
:
0
;
top
:
auto
;
z-index
:
1000
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
a
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
a
{
color
:
#578EA9
;
}
...
...
@@ -5244,7 +5246,7 @@ body.reset {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
/* offset-x | offset-y | blur-radius | spread-radius | color */
box-shadow
:
0
-1px
2
px
0
rgba
(
0
,
0
,
0
,
0.4
);
}
box-shadow
:
0
-1px
1
px
0
rgba
(
0
,
0
,
0
,
0.4
);
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
overflow
:
hidden
;
...
...
@@ -5275,6 +5277,11 @@ body.reset {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
li
a
:hover
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
li
a
:hover
{
color
:
#8f2831
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
ul
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
ul
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
li
:hover
,
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-skintone-picker
li
:hover
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
li
:hover
,
...
...
css/inverse.css
View file @
9825d6e7
...
...
@@ -5277,12 +5277,14 @@ body {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
{
background-color
:
#fff
;
bottom
:
100%
;
bottom
:
2rem
;
box-shadow
:
-1px
-1px
2px
0
rgba
(
0
,
0
,
0
,
0.4
);
font-size
:
12px
;
m
argin
:
0
;
margin-bottom
:
0
;
m
in-width
:
20rem
;
position
:
absolute
;
right
:
0
;
}
right
:
0
;
top
:
auto
;
z-index
:
1000
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
a
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
a
{
color
:
#578EA9
;
}
...
...
@@ -5294,7 +5296,7 @@ body {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
/* offset-x | offset-y | blur-radius | spread-radius | color */
box-shadow
:
0
-1px
2
px
0
rgba
(
0
,
0
,
0
,
0.4
);
}
box-shadow
:
0
-1px
1
px
0
rgba
(
0
,
0
,
0
,
0.4
);
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
overflow
:
hidden
;
...
...
@@ -5325,6 +5327,11 @@ body {
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
li
a
:hover
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
li
a
:hover
{
color
:
#8f2831
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
ul
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
ul
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
li
:hover
,
#converse-embedded-chat
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-skintone-picker
li
:hover
,
#conversejs
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
li
:hover
,
...
...
sass/_chatbox.scss
View file @
9825d6e7
...
...
@@ -375,12 +375,15 @@
}
.toolbar-menu
{
background-color
:
#fff
;
bottom
:
100%
;
bottom
:
2rem
;
box-shadow
:
-1px
-1px
2px
0
rgba
(
0
,
0
,
0
,
0
.4
);
font-size
:
12px
;
m
argin
:
0
;
margin-bottom
:
0
;
m
in-width
:
20rem
;
position
:
absolute
;
right
:
0
;
top
:
auto
;
z-index
:
$zindex-dropdown
;
a
{
color
:
$link-color
;
}
...
...
@@ -392,7 +395,7 @@
}
&
.emoji-toolbar
{
/* offset-x | offset-y | blur-radius | spread-radius | color */
box-shadow
:
0
-1px
2
px
0
rgba
(
0
,
0
,
0
,
0
.4
);
box-shadow
:
0
-1px
1
px
0
rgba
(
0
,
0
,
0
,
0
.4
);
}
&
.emoji-toolbar
{
overflow
:
hidden
;
...
...
@@ -430,6 +433,14 @@
}
&
.toggle-smiley
{
.emoji-toolbar
{
.emoji-category-picker
{
ul
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
}
.emoji-category-picker
,
.emoji-skintone-picker
{
li
:hover
{
...
...
src/converse-chatview.js
View file @
9825d6e7
...
...
@@ -9,7 +9,6 @@
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
"
converse-chatboxes
"
,
"
bootstrap
"
,
"
emojione
"
,
"
xss
"
,
...
...
@@ -25,11 +24,11 @@
"
tpl!spinner
"
,
"
tpl!spoiler_button
"
,
"
tpl!spoiler_message
"
,
"
tpl!toolbar
"
"
tpl!toolbar
"
,
"
converse-chatboxes
"
],
factory
);
}(
this
,
function
(
converse
,
dummy
,
bootstrap
,
emojione
,
xss
,
...
...
@@ -66,7 +65,7 @@
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies
:
[
"
converse-chatboxes
"
,
"
converse-disco
"
],
dependencies
:
[
"
converse-chatboxes
"
,
"
converse-disco
"
,
"
converse-dropdown
"
],
overrides
:
{
// Overrides mentioned here will be picked up by converse.js's
...
...
@@ -80,6 +79,8 @@
this
.
__super__
.
registerGlobalEventHandlers
();
_converse
.
root
.
addEventListener
(
'
click
'
,
function
(
ev
)
{
// FIXME
return
;
if
(
_
.
includes
(
ev
.
target
.
classList
,
'
toggle-toolbar-menu
'
)
||
_
.
includes
(
ev
.
target
.
classList
,
'
insert-emoji
'
))
{
return
;
...
...
@@ -151,7 +152,7 @@
}
});
_converse
.
EmojiPickerView
=
Backbone
.
Native
View
.
extend
({
_converse
.
EmojiPickerView
=
Backbone
.
VDOM
View
.
extend
({
className
:
'
emoji-picker-container
'
,
events
:
{
'
click .emoji-category-picker li.emoji-category
'
:
'
chooseCategory
'
,
...
...
@@ -161,11 +162,10 @@
initialize
()
{
this
.
model
.
on
(
'
change:current_skintone
'
,
this
.
render
,
this
);
this
.
model
.
on
(
'
change:current_category
'
,
this
.
render
,
this
);
this
.
setScrollPosition
=
_
.
debounce
(
this
.
setScrollPosition
,
50
);
},
render
()
{
var
emojis_html
=
tpl_emojis
(
toHTML
()
{
return
tpl_emojis
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
'
transform
'
:
_converse
.
use_emojione
?
emojione
.
shortnameToImage
:
emojione
.
shortnameToUnicode
,
...
...
@@ -175,12 +175,6 @@
'
shouldBeHidden
'
:
this
.
shouldBeHidden
}
));
this
.
el
.
innerHTML
=
emojis_html
;
_
.
forEach
(
this
.
el
.
querySelectorAll
(
'
.emoji-picker
'
),
(
el
)
=>
{
el
.
addEventListener
(
'
scroll
'
,
this
.
setScrollPosition
.
bind
(
this
));
});
this
.
restoreScrollPosition
();
return
this
;
},
shouldBeHidden
(
shortname
,
current_skintone
,
toned_emojis
)
{
...
...
@@ -200,20 +194,6 @@
return
false
;
},
restoreScrollPosition
()
{
const
current_picker
=
_
.
difference
(
this
.
el
.
querySelectorAll
(
'
.emoji-picker
'
),
this
.
el
.
querySelectorAll
(
'
.emoji-picker.hidden
'
)
);
if
(
current_picker
.
length
===
1
&&
this
.
model
.
get
(
'
scroll_position
'
))
{
current_picker
[
0
].
scrollTop
=
this
.
model
.
get
(
'
scroll_position
'
);
}
},
setScrollPosition
(
ev
)
{
this
.
model
.
save
(
'
scroll_position
'
,
this
.
content
);
},
chooseSkinTone
(
ev
)
{
ev
.
preventDefault
();
ev
.
stopPropagation
();
...
...
@@ -1005,32 +985,12 @@
},
toggleEmojiMenu
(
ev
)
{
const
dropdown_el
=
this
.
el
.
querySelector
(
'
.toggle-smiley.dropup
'
);
const
dropdown
=
new
bootstrap
.
Dropdown
(
dropdown_el
,
true
);
dropdown
.
toggle
();
return
;
if
(
u
.
hasClass
(
'
insert-emoji
'
,
ev
.
target
))
{
return
;
if
(
_
.
isUndefined
(
this
.
dropdown
))
{
this
.
renderEmojiPicker
();
const
dropdown_el
=
this
.
el
.
querySelector
(
'
.toggle-smiley.dropup
'
);
this
.
dropdown
=
new
bootstrap
.
Dropdown
(
dropdown_el
,
true
);
this
.
dropdown
.
toggle
();
}
if
(
!
_
.
isUndefined
(
ev
))
{
ev
.
stopPropagation
();
if
(
ev
.
target
.
classList
.
contains
(
'
emoji-category-picker
'
)
||
ev
.
target
.
classList
.
contains
(
'
emoji-skintone-picker
'
)
||
ev
.
target
.
classList
.
contains
(
'
emoji-category
'
))
{
return
;
}
}
const
elements
=
_
.
difference
(
_converse
.
root
.
querySelectorAll
(
'
.toolbar-menu
'
),
[
this
.
emoji_picker_view
.
el
]
);
u
.
slideInAllElements
(
elements
)
.
then
(
_
.
partial
(
u
.
slideToggleElement
,
this
.
emoji_picker_view
.
el
))
.
then
(
this
.
focus
.
bind
(
this
));
},
toggleCall
(
ev
)
{
...
...
@@ -1139,7 +1099,6 @@
}
this
.
setChatState
(
_converse
.
ACTIVE
);
this
.
scrollDown
();
this
.
renderEmojiPicker
();
if
(
focus
)
{
this
.
focus
();
}
...
...
src/converse-core.js
View file @
9825d6e7
...
...
@@ -74,6 +74,7 @@
'
converse-core
'
,
'
converse-disco
'
,
'
converse-dragresize
'
,
'
converse-dropdown
'
,
'
converse-fullscreen
'
,
'
converse-headline
'
,
'
converse-mam
'
,
...
...
src/templates/chatroom_toolbar.html
View file @
9825d6e7
{[ if (o.use_emoji) { ]}
<li
class=
"toggle-toolbar-menu toggle-smiley fa fa-smile-o dropdown dropup"
>
<a
class=
"btn dropdown-toggle"
title=
"{{{o.label_insert_smiley}}}"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
></a>
<div
class=
"emoji-picker dropdown-menu"
style=
"top: auto; bottom: 2em; height: 10em; overflow-y: scroll"
></div>
<li
class=
"toggle-toolbar-menu toggle-smiley fa fa-smile-o dropup"
>
<div
class=
"emoji-picker dropdown-menu toolbar-menu"
></div>
</li>
{[ } ]}
{[ if (o.show_call_button) { ]}
...
...
src/templates/emojis.html
View file @
9825d6e7
<div
class=
"emoji-picker-container"
>
{[ _.forEach(o.emojis_by_category, function (obj, category) { ]}
<ul
class=
"emoji-picker emoji-picker-{{{category}}} {[ if (o.current_category !== category) { ]} hidden {[ } ]}"
>
{[ _.forEach(o.emojis_by_category[category], function (emoji) { ]}
...
...
@@ -28,3 +29,4 @@
</ul>
</li>
</ul>
</div>
src/templates/toolbar.html
View file @
9825d6e7
{[ if (o.use_emoji) { ]}
<li
class=
"toggle-toolbar-menu toggle-smiley fa fa-smile-o dropdown"
>
<a
class=
"btn dropdown-toggle"
title=
"{{{o.label_insert_smiley}}}"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
></a>
<span
class=
"emoji-picker dropdown-menu"
></a>
<li
class=
"toggle-toolbar-menu toggle-smiley fa fa-smile-o dropup"
>
<div
class=
"emoji-picker dropdown-menu toolbar-menu"
></div>
</li>
{[ } ]}
{[ if (o.show_call_button) { ]}
...
...
src/utils.js
View file @
9825d6e7
...
...
@@ -321,6 +321,7 @@
steps
=
duration
/
17
;
// We assume 17ms per animation which is ~60FPS
let
height
=
original_height
;
debugger
;
el
.
style
.
overflow
=
'
hidden
'
;
function
draw
()
{
...
...
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