Просмотр исходного кода

Merge pull request #3538 from overleaf/ta-file-tree-no-selection

[ReactFileTree] Update Editor View on Empty Selection

GitOrigin-RevId: 18744cd64c2a012488c3d0969549ae464e752a4b
Timothée Alby 5 лет назад
Родитель
Сommit
e7c4ce6e80

+ 2 - 0
services/web/frontend/js/features/file-tree/controllers/file-tree-controller.js

@@ -58,6 +58,8 @@ App.controller('ReactFileTreeController', function(
       $scope.$emit('entities:multiSelected', {
         count: selectedEntities.length
       })
+    } else {
+      $scope.$emit('entity:no-selection')
     }
   }
 })

+ 6 - 0
services/web/frontend/js/ide/editor/EditorManager.js

@@ -48,6 +48,12 @@ export default EditorManager = (function() {
         }
       })
 
+      this.$scope.$on('entity:no-selection', () => {
+        this.$scope.$apply(() => {
+          this.$scope.ui.view = null
+        })
+      })
+
       this.$scope.$on('entity:deleted', (event, entity) => {
         if (this.$scope.editor.open_doc_id === entity.id) {
           if (!this.$scope.project.rootDoc_id) {