mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Support saving state to local storage.
This commit is contained in:
parent
0b7863185c
commit
33c8bc8684
1 changed files with 11 additions and 1 deletions
|
@ -4,7 +4,7 @@ define [
|
||||||
"ide/colors/ColorManager"
|
"ide/colors/ColorManager"
|
||||||
"ide/review-panel/RangesTracker"
|
"ide/review-panel/RangesTracker"
|
||||||
], (App, EventEmitter, ColorManager, RangesTracker) ->
|
], (App, EventEmitter, ColorManager, RangesTracker) ->
|
||||||
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking) ->
|
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking, localStorage) ->
|
||||||
$reviewPanelEl = $element.find "#review-panel"
|
$reviewPanelEl = $element.find "#review-panel"
|
||||||
|
|
||||||
$scope.SubViews =
|
$scope.SubViews =
|
||||||
|
@ -28,6 +28,16 @@ define [
|
||||||
rendererData: {}
|
rendererData: {}
|
||||||
loadingThreads: false
|
loadingThreads: false
|
||||||
|
|
||||||
|
$scope.$on "project:joined", () ->
|
||||||
|
$scope.reviewPanel.overview.docsCollapsedState = JSON.parse(localStorage("docs_collapsed_state:#{$scope.project_id}")) or {}
|
||||||
|
|
||||||
|
window.addEventListener "beforeunload", () ->
|
||||||
|
collapsedStates = {}
|
||||||
|
for doc, state of $scope.reviewPanel.overview.docsCollapsedState
|
||||||
|
collapsedStates[doc] = state if state is true
|
||||||
|
valToStore = if Object.keys(collapsedStates).length > 0 then JSON.stringify(collapsedStates) else null
|
||||||
|
localStorage("docs_collapsed_state:#{$scope.project_id}", valToStore)
|
||||||
|
|
||||||
$scope.$on "layout:pdf:linked", (event, state) ->
|
$scope.$on "layout:pdf:linked", (event, state) ->
|
||||||
$scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed)
|
$scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed)
|
||||||
$scope.$broadcast "review-panel:layout"
|
$scope.$broadcast "review-panel:layout"
|
||||||
|
|
Loading…
Reference in a new issue