mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Allow multiple events to trigger layout external resizes.
This commit is contained in:
parent
d59fe61a83
commit
7e86218b21
4 changed files with 15 additions and 10 deletions
|
@ -65,7 +65,7 @@ block content
|
|||
ng-class="{ 'ide-history-open' : (ui.view == 'history' && history.isV2 && history.viewMode === HistoryViewModes.POINT_IN_TIME) }",
|
||||
layout="main",
|
||||
ng-hide="state.loading",
|
||||
resize-on="layout:chat:resize",
|
||||
resize-on="layout:chat:resize,history:toggle",
|
||||
minimum-restore-size-west="130"
|
||||
custom-toggler-pane=hasFeature('custom-togglers') ? "'west'" : "false"
|
||||
custom-toggler-msg-when-open=hasFeature('custom-togglers') ? "'" + translate("tooltip_hide_filetree") + "'" : "false"
|
||||
|
|
|
@ -112,7 +112,8 @@ define [
|
|||
element.layout().resizeAll()
|
||||
|
||||
if attrs.resizeOn?
|
||||
scope.$on attrs.resizeOn, () -> onExternalResize()
|
||||
for event in attrs.resizeOn.split ","
|
||||
scope.$on event, () -> onExternalResize()
|
||||
|
||||
if hasCustomToggler
|
||||
state = element.layout().readState()
|
||||
|
|
|
@ -27,6 +27,9 @@ define [
|
|||
@hide()
|
||||
else
|
||||
@show()
|
||||
@ide.$timeout () =>
|
||||
@$scope.$broadcast "history:toggle"
|
||||
, 0
|
||||
|
||||
@$scope.toggleHistoryViewMode = () =>
|
||||
if @$scope.history.viewMode == HistoryViewModes.COMPARE
|
||||
|
@ -124,6 +127,10 @@ define [
|
|||
return if @$scope.history.updates.length == 0
|
||||
@selectUpdate @$scope.history.updates[0]
|
||||
|
||||
autoSelectLastLabel: () ->
|
||||
return if @$scope.history.labels.length == 0
|
||||
@selectLabel @$scope.history.labels[0]
|
||||
|
||||
selectUpdate: (update) ->
|
||||
selectedUpdateIndex = @$scope.history.updates.indexOf update
|
||||
if selectedUpdateIndex == -1
|
||||
|
@ -135,10 +142,6 @@ define [
|
|||
@$scope.history.updates[selectedUpdateIndex].selectedFrom = true
|
||||
@loadFileTreeForUpdate @$scope.history.updates[selectedUpdateIndex]
|
||||
|
||||
selectLastLabel = () ->
|
||||
return if @$scope.history.labels.length == 0
|
||||
# TODO Select last label
|
||||
|
||||
selectedLabelFromUpdatesSelection: () ->
|
||||
nLabels = @$scope.history.selection.updates?[0]?.labels?.length
|
||||
if nLabels == 1
|
||||
|
@ -184,12 +187,12 @@ define [
|
|||
@ide.$q.all requests
|
||||
.then (response) =>
|
||||
updatesData = response.updates.data
|
||||
if response.labels?
|
||||
@$scope.history.labels = @_sortLabelsByVersionAndDate response.labels.data
|
||||
@_loadUpdates(updatesData.updates)
|
||||
@$scope.history.nextBeforeTimestamp = updatesData.nextBeforeTimestamp
|
||||
if !updatesData.nextBeforeTimestamp?
|
||||
@$scope.history.atEnd = true
|
||||
if response.labels?
|
||||
@$scope.history.labels = @_sortLabelsByVersionAndDate response.labels.data
|
||||
@$scope.history.loading = false
|
||||
|
||||
_sortLabelsByVersionAndDate: (labels) ->
|
||||
|
@ -354,7 +357,7 @@ define [
|
|||
@autoSelectRecentUpdates()
|
||||
else
|
||||
if @$scope.history.showOnlyLabels
|
||||
@selectLastLabel()
|
||||
@autoSelectLastLabel()
|
||||
else
|
||||
@autoSelectLastUpdate()
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@ define [
|
|||
], (App) ->
|
||||
# We create and provide this as service so that we can access the global ide
|
||||
# from within other parts of the angular app.
|
||||
App.factory "ide", ["$http", "queuedHttp", "$modal", "$q", "$filter", ($http, queuedHttp, $modal, $q, $filter) ->
|
||||
App.factory "ide", ["$http", "queuedHttp", "$modal", "$q", "$filter", "$timeout", ($http, queuedHttp, $modal, $q, $filter, $timeout) ->
|
||||
ide = {}
|
||||
ide.$http = $http
|
||||
ide.queuedHttp = queuedHttp
|
||||
ide.$q = $q
|
||||
ide.$filter = $filter
|
||||
ide.$timeout = $timeout
|
||||
|
||||
@recentEvents = []
|
||||
ide.pushEvent = (type, meta = {}) =>
|
||||
|
|
Loading…
Reference in a new issue