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

Merge pull request #10794 from overleaf/td-resize-while-loading

Ensure editor is the correct size after window resize during load

GitOrigin-RevId: 0677ef6aa5d1dd7b6aea9158343b8ccbb3a6562b
Tim Down 3 лет назад
Родитель
Сommit
fde8ab422b

+ 1 - 0
services/web/frontend/js/ide/LoadingManager.js

@@ -17,6 +17,7 @@ class LoadingManager {
         this.$scope.$apply(() => {
           this.$scope.state.load_progress = 100
           this.$scope.state.loading = false
+          this.$scope.$emit('editor:loaded')
         })
       })
       // Note: this will only catch errors in from i18n setup. ConnectionManager

+ 6 - 0
services/web/frontend/js/ide/directives/layout.js

@@ -236,6 +236,12 @@ ng-click=\"handleClick()\">\
             .$applyAsync(() => (customTogglerEl.scope().isOpen = false))
         }
 
+        // Ensure editor resizes after loading. This is to handle the case where
+        // the window has been resized while the editor is loading
+        scope.$on('editor:loaded', () => {
+          ide.$timeout(() => layout.resizeAll())
+        })
+
         // Save state when exiting
         $(window).unload(() => {
           // Save only the state properties for the current layout, ignoring sublayouts inside it.