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
3f940283
Commit
3f940283
authored
Dec 19, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up rendering of chat boxes by lazily rendering the emoji picker
parent
19979c48
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
20 deletions
+13
-20
src/converse-chatboxes.js
src/converse-chatboxes.js
+2
-2
src/converse-chatview.js
src/converse-chatview.js
+8
-16
src/converse-muc.js
src/converse-muc.js
+1
-0
src/converse-singleton.js
src/converse-singleton.js
+2
-2
No files found.
src/converse-chatboxes.js
View file @
3f940283
...
...
@@ -443,8 +443,8 @@
showChat
(
attrs
)
{
/* Find the chat box and show it (if it may be shown).
* If it doesn't exist, create it.
*/
* If it doesn't exist, create it.
*/
const
chatbox
=
this
.
getChatBox
(
attrs
,
true
);
if
(
this
.
chatBoxMayBeShown
(
chatbox
))
{
chatbox
.
trigger
(
'
show
'
,
true
);
...
...
src/converse-chatview.js
View file @
3f940283
...
...
@@ -275,6 +275,7 @@
this
.
model
.
on
(
'
sendMessage
'
,
this
.
sendMessage
,
this
);
this
.
render
().
renderToolbar
().
insertHeading
().
fetchMessages
();
this
.
createEmojiPicker
();
u
.
refreshWebkit
();
_converse
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
emit
(
'
chatBoxInitialized
'
,
this
);
...
...
@@ -906,10 +907,13 @@
);
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
innerHTML
=
toolbar
(
options
);
return
this
;
},
renderEmojiPicker
()
{
var
toggle
=
this
.
el
.
querySelector
(
'
.toggle-smiley
'
);
toggle
.
innerHTML
=
''
;
toggle
.
appendChild
(
this
.
emoji_picker_view
.
render
().
el
);
return
this
;
},
focus
()
{
...
...
@@ -929,15 +933,15 @@
this
.
model
.
save
();
}
this
.
setChatState
(
_converse
.
ACTIVE
);
this
.
renderEmojiPicker
();
this
.
scrollDown
();
if
(
focus
)
{
this
.
focus
();
}
},
_show
(
focus
)
{
/* Inner show method that gets debounced */
if
(
this
.
$el
.
is
(
'
:visible
'
)
&&
this
.
$el
.
css
(
'
opacity
'
)
===
"
1
"
)
{
show
(
focus
)
{
if
(
u
.
isVisible
(
this
.
el
)
&&
this
.
$el
.
css
(
'
opacity
'
)
===
"
1
"
)
{
if
(
focus
)
{
this
.
focus
();
}
return
;
}
...
...
@@ -948,18 +952,6 @@
});
},
show
(
focus
)
{
if
(
_
.
isUndefined
(
this
.
debouncedShow
))
{
/* We wrap the method in a debouncer and set it on the
* instance, so that we have it debounced per instance.
* Debouncing it on the class-level is too broad.
*/
this
.
debouncedShow
=
_
.
debounce
(
this
.
_show
,
250
,
{
'
leading
'
:
true
});
}
this
.
debouncedShow
.
apply
(
this
,
arguments
);
return
this
;
},
hideNewMessagesIndicator
()
{
const
new_msgs_indicator
=
this
.
el
.
querySelector
(
'
.new-msgs-indicator
'
);
if
(
!
_
.
isNull
(
new_msgs_indicator
))
{
...
...
src/converse-muc.js
View file @
3f940283
...
...
@@ -567,6 +567,7 @@
afterConnected
()
{
if
(
this
.
model
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
)
{
this
.
setChatState
(
_converse
.
ACTIVE
);
this
.
renderEmojiPicker
();
this
.
scrollDown
();
this
.
focus
();
}
...
...
src/converse-singleton.js
View file @
3f940283
...
...
@@ -92,14 +92,14 @@
},
ChatBoxView
:
{
_
show
(
focus
)
{
show
(
focus
)
{
/* We only have one chat visible at any one
* time. So before opening a chat, we make sure all other
* chats are hidden.
*/
if
(
!
this
.
model
.
get
(
'
hidden
'
))
{
_
.
each
(
this
.
__super__
.
_converse
.
chatboxviews
.
xget
(
this
.
model
.
get
(
'
id
'
)),
hideChat
);
return
this
.
__super__
.
_
show
.
apply
(
this
,
arguments
);
return
this
.
__super__
.
show
.
apply
(
this
,
arguments
);
}
}
},
...
...
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