mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Relayout review panel as needed
This commit is contained in:
parent
74ddd33bd9
commit
1622269d1b
2 changed files with 16 additions and 6 deletions
|
@ -39,9 +39,8 @@ define [
|
|||
|
||||
$scope.$watch "ui.reviewPanelOpen", (reviewPanelOpen) ->
|
||||
return if !reviewPanelOpen?
|
||||
setTimeout () ->
|
||||
$scope.$broadcast "reviewPanel:toggle"
|
||||
if reviewPanelOpen
|
||||
$scope.$broadcast "review-panel:layout"
|
||||
scroller.on "scroll", scrollAce
|
||||
$scope.onScroll = scrollPanel # Passed into the editor directive for it to call
|
||||
else
|
||||
|
@ -63,15 +62,18 @@ define [
|
|||
$scope.startNewComment = () ->
|
||||
$scope.commentState.adding = true
|
||||
$scope.$broadcast "comment:select_line"
|
||||
$scope.$broadcast "review-panel:layout"
|
||||
|
||||
$scope.submitNewComment = () ->
|
||||
$scope.commentState.adding = false
|
||||
$scope.$broadcast "comment:add", $scope.commentState.content
|
||||
$scope.commentState.content = ""
|
||||
$scope.$broadcast "review-panel:layout"
|
||||
|
||||
$scope.startReply = (entry) ->
|
||||
console.log "Start new reply"
|
||||
entry.replying = true
|
||||
$scope.$broadcast "review-panel:layout"
|
||||
|
||||
$scope.submitReply = (entry) ->
|
||||
entry.thread.push {
|
||||
|
@ -80,4 +82,5 @@ define [
|
|||
user_id: window.user_id
|
||||
}
|
||||
entry.replyContent = ""
|
||||
entry.replying = false
|
||||
entry.replying = false
|
||||
$scope.$broadcast "review-panel:layout"
|
|
@ -1,11 +1,10 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.directive "reviewPanelSorted", () ->
|
||||
App.directive "reviewPanelSorted", ($timeout) ->
|
||||
return {
|
||||
link: (scope, element, attrs) ->
|
||||
scope.$watch "reviewPanel.entries", (value) ->
|
||||
return if !value?
|
||||
layout = () ->
|
||||
entries = []
|
||||
for el in element.find(".review-entry")
|
||||
entries.push {
|
||||
|
@ -21,4 +20,12 @@ define [
|
|||
top = Math.max(top, previousBottom + 12)
|
||||
previousBottom = top + height
|
||||
entry.scope.top = top
|
||||
|
||||
scope.$watch "reviewPanel.entries", (value) ->
|
||||
return if !value?
|
||||
layout()
|
||||
|
||||
scope.$on "review-panel:layout", () ->
|
||||
$timeout () ->
|
||||
layout()
|
||||
}
|
Loading…
Reference in a new issue