mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 11:14:14 -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) ->
|
$scope.$watch "ui.reviewPanelOpen", (reviewPanelOpen) ->
|
||||||
return if !reviewPanelOpen?
|
return if !reviewPanelOpen?
|
||||||
setTimeout () ->
|
|
||||||
$scope.$broadcast "reviewPanel:toggle"
|
|
||||||
if reviewPanelOpen
|
if reviewPanelOpen
|
||||||
|
$scope.$broadcast "review-panel:layout"
|
||||||
scroller.on "scroll", scrollAce
|
scroller.on "scroll", scrollAce
|
||||||
$scope.onScroll = scrollPanel # Passed into the editor directive for it to call
|
$scope.onScroll = scrollPanel # Passed into the editor directive for it to call
|
||||||
else
|
else
|
||||||
|
@ -63,15 +62,18 @@ define [
|
||||||
$scope.startNewComment = () ->
|
$scope.startNewComment = () ->
|
||||||
$scope.commentState.adding = true
|
$scope.commentState.adding = true
|
||||||
$scope.$broadcast "comment:select_line"
|
$scope.$broadcast "comment:select_line"
|
||||||
|
$scope.$broadcast "review-panel:layout"
|
||||||
|
|
||||||
$scope.submitNewComment = () ->
|
$scope.submitNewComment = () ->
|
||||||
$scope.commentState.adding = false
|
$scope.commentState.adding = false
|
||||||
$scope.$broadcast "comment:add", $scope.commentState.content
|
$scope.$broadcast "comment:add", $scope.commentState.content
|
||||||
$scope.commentState.content = ""
|
$scope.commentState.content = ""
|
||||||
|
$scope.$broadcast "review-panel:layout"
|
||||||
|
|
||||||
$scope.startReply = (entry) ->
|
$scope.startReply = (entry) ->
|
||||||
console.log "Start new reply"
|
console.log "Start new reply"
|
||||||
entry.replying = true
|
entry.replying = true
|
||||||
|
$scope.$broadcast "review-panel:layout"
|
||||||
|
|
||||||
$scope.submitReply = (entry) ->
|
$scope.submitReply = (entry) ->
|
||||||
entry.thread.push {
|
entry.thread.push {
|
||||||
|
@ -80,4 +82,5 @@ define [
|
||||||
user_id: window.user_id
|
user_id: window.user_id
|
||||||
}
|
}
|
||||||
entry.replyContent = ""
|
entry.replyContent = ""
|
||||||
entry.replying = false
|
entry.replying = false
|
||||||
|
$scope.$broadcast "review-panel:layout"
|
|
@ -1,11 +1,10 @@
|
||||||
define [
|
define [
|
||||||
"base"
|
"base"
|
||||||
], (App) ->
|
], (App) ->
|
||||||
App.directive "reviewPanelSorted", () ->
|
App.directive "reviewPanelSorted", ($timeout) ->
|
||||||
return {
|
return {
|
||||||
link: (scope, element, attrs) ->
|
link: (scope, element, attrs) ->
|
||||||
scope.$watch "reviewPanel.entries", (value) ->
|
layout = () ->
|
||||||
return if !value?
|
|
||||||
entries = []
|
entries = []
|
||||||
for el in element.find(".review-entry")
|
for el in element.find(".review-entry")
|
||||||
entries.push {
|
entries.push {
|
||||||
|
@ -21,4 +20,12 @@ define [
|
||||||
top = Math.max(top, previousBottom + 12)
|
top = Math.max(top, previousBottom + 12)
|
||||||
previousBottom = top + height
|
previousBottom = top + height
|
||||||
entry.scope.top = top
|
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