mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 13:40:17 -05:00
6ab9fffb49
GitOrigin-RevId: feeae54575cce8b315b4e6bb0df3e17405025855
23 lines
656 B
JavaScript
23 lines
656 B
JavaScript
import App from '../../../base'
|
|
|
|
export default App.controller(
|
|
'FileTreeFolderController',
|
|
function ($scope, ide, $modal, localStorage) {
|
|
$scope.expanded =
|
|
localStorage(`folder.${$scope.entity.id}.expanded`) || false
|
|
|
|
$scope.toggleExpanded = function () {
|
|
$scope.expanded = !$scope.expanded
|
|
$scope._storeCurrentStateInLocalStorage()
|
|
}
|
|
|
|
$scope.$on('entity-file:selected', function () {
|
|
$scope.expanded = true
|
|
$scope._storeCurrentStateInLocalStorage()
|
|
})
|
|
|
|
$scope._storeCurrentStateInLocalStorage = function () {
|
|
localStorage(`folder.${$scope.entity.id}.expanded`, $scope.expanded)
|
|
}
|
|
}
|
|
)
|