mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-06 08:23:57 +00:00
Small chat scroll tweaks
This commit is contained in:
parent
e0266e309f
commit
1d7a595c6c
4 changed files with 7 additions and 5 deletions
|
@ -6,7 +6,7 @@ aside.chat(
|
|||
infinite-scroll-disabled="chat.loading || chat.atEnd"
|
||||
infinite-scroll-initialize="ui.chatOpen"
|
||||
infinite-scroll-upwards="true"
|
||||
update-scroll-bottom-on="messages:updated"
|
||||
update-scroll-bottom-on="updateScrollPosition"
|
||||
)
|
||||
.infinite-scroll-inner
|
||||
.loading(ng-show="chat.loading")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.directive "updateScrollBottomOn", ->
|
||||
App.directive "updateScrollBottomOn", ($timeout) ->
|
||||
return {
|
||||
restrict: "A"
|
||||
link: (scope, element, attrs, ctrls) ->
|
||||
|
@ -29,7 +29,7 @@ define [
|
|||
scrollBottom = element[0].scrollHeight - element[0].scrollTop - element[0].clientHeight
|
||||
|
||||
scope.$on attrs.updateScrollBottomOn, () ->
|
||||
setTimeout () ->
|
||||
$timeout () ->
|
||||
element.scrollTop(element[0].scrollHeight - element[0].clientHeight - scrollBottom)
|
||||
, 0
|
||||
}
|
||||
|
|
|
@ -7,8 +7,11 @@ define [
|
|||
|
||||
$scope.$watch "chat.messages", (messages) ->
|
||||
if messages?
|
||||
$scope.$emit "messages:updated"
|
||||
$scope.$emit "updateScrollPosition"
|
||||
, true # Deep watch
|
||||
|
||||
$scope.$on "layout:chat:resize", () ->
|
||||
$scope.$emit "updateScrollPosition"
|
||||
|
||||
$scope.sendMessage = ->
|
||||
chatMessages
|
||||
|
|
|
@ -34,7 +34,6 @@ define [
|
|||
messages.reverse()
|
||||
prependMessages(messages)
|
||||
chat.state.nextBeforeTimestamp = chat.state.messages[0]?.timestamp
|
||||
console.log messages, chat.state
|
||||
|
||||
TIMESTAMP_GROUP_SIZE = 5 * 60 * 1000 # 5 minutes
|
||||
|
||||
|
|
Loading…
Reference in a new issue