mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 19:30:45 -05:00
25 lines
No EOL
604 B
CoffeeScript
25 lines
No EOL
604 B
CoffeeScript
define [
|
|
"base"
|
|
"ide/chat/services/chatMessages"
|
|
], (App) ->
|
|
App.controller "ChatController", ($scope, chatMessages, @ide, $location) ->
|
|
$scope.chat = chatMessages.state
|
|
|
|
$scope.$watch "chat.messages", (messages) ->
|
|
if messages?
|
|
$scope.$emit "updateScrollPosition"
|
|
, true # Deep watch
|
|
|
|
$scope.$on "layout:chat:resize", () ->
|
|
$scope.$emit "updateScrollPosition"
|
|
|
|
$scope.sendMessage = ->
|
|
chatMessages
|
|
.sendMessage $scope.newMessageContent
|
|
.then () ->
|
|
$scope.newMessageContent = ""
|
|
|
|
$scope.loadMoreMessages = ->
|
|
chatMessages.loadMoreMessages()
|
|
|
|
|