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
2cb4a36a
Commit
2cb4a36a
authored
Jan 16, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates #984: Remember scroll position when using infinite scroll.
parent
95bf69b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
CHANGES.md
CHANGES.md
+1
-0
src/converse-chatview.js
src/converse-chatview.js
+32
-3
No files found.
CHANGES.md
View file @
2cb4a36a
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
-
`hide_open_bookmarks`
is now by default
`true`
.
-
`hide_open_bookmarks`
is now by default
`true`
.
### UX/UI changes
### UX/UI changes
-
#984 Improve loading of archived messages via "infinite scroll"
-
Use CSS3 fade transitions to render various elements.
-
Use CSS3 fade transitions to render various elements.
-
Remove
`Login`
and
`Registration`
tabs and consolidate into one panel.
-
Remove
`Login`
and
`Registration`
tabs and consolidate into one panel.
-
Show validation error messages on the login form.
-
Show validation error messages on the login form.
...
...
src/converse-chatview.js
View file @
2cb4a36a
...
@@ -483,7 +483,30 @@
...
@@ -483,7 +483,30 @@
}
}
this
.
insertDayIndicator
(
message_el
);
this
.
insertDayIndicator
(
message_el
);
this
.
clearStatusNotification
();
this
.
clearStatusNotification
();
this
.
scrollDown
();
this
.
setScrollPosition
(
message_el
);
},
setScrollPosition
(
message_el
)
{
/* Given a newly inserted message, determine whether we
* should keep the scrollbar in place (so as to not scroll
* up when using infinite scroll).
*/
if
(
this
.
model
.
get
(
'
scrolled
'
))
{
const
next_msg_el
=
u
.
getNextElement
(
message_el
,
"
.chat-message
"
);
if
(
next_msg_el
)
{
// The currently received message is not new, there
// are newer messages after it. So let's see if we
// should maintain our current scroll position.
if
(
this
.
content
.
scrollTop
===
0
||
this
.
model
.
get
(
'
top_visible_message
'
))
{
const
top_visible_message
=
this
.
model
.
get
(
'
top_visible_message
'
)
||
next_msg_el
;
this
.
model
.
set
(
'
top_visible_message
'
,
top_visible_message
);
this
.
content
.
scrollTop
=
top_visible_message
.
offsetTop
-
30
;
}
}
}
else
{
this
.
scrollDown
();
}
},
},
getExtraMessageTemplateAttributes
()
{
getExtraMessageTemplateAttributes
()
{
...
@@ -1008,11 +1031,17 @@
...
@@ -1008,11 +1031,17 @@
scrolled
=
false
;
scrolled
=
false
;
this
.
onScrolledDown
();
this
.
onScrolledDown
();
}
}
u
.
safeSave
(
this
.
model
,
{
'
scrolled
'
:
scrolled
});
u
.
safeSave
(
this
.
model
,
{
'
scrolled
'
:
scrolled
,
'
top_visible_message
'
:
null
});
},
},
viewUnreadMessages
()
{
viewUnreadMessages
()
{
this
.
model
.
save
(
'
scrolled
'
,
false
);
this
.
model
.
save
({
'
scrolled
'
:
false
,
'
top_visible_message
'
:
null
});
this
.
scrollDown
();
this
.
scrollDown
();
},
},
...
...
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