Răsfoiți Sursa

Merge pull request #7795 from overleaf/ae-history-view

Avoid switching away from v1 history view when a file is selected

GitOrigin-RevId: 7b7d75f5e4c63bf899fc7f1f5c7c17119863177b
Alf Eaton 4 ani în urmă
părinte
comite
3a81428ef3

+ 10 - 1
services/web/app/views/project/editor/history/diffPanelV1.pug

@@ -1,6 +1,15 @@
 .diff-panel.full-size(ng-if="!history.isV2", ng-controller="HistoryDiffController")
 .diff-panel.full-size(ng-if="!history.isV2", ng-controller="HistoryDiffController")
+	div(
+		ng-controller="FileViewController"
+		ng-if="ui.view == 'history' && openFile"
+	)
+		file-view(
+			file="file"
+			store-references-keys="storeReferencesKeys"
+		)
+
 	.diff(
 	.diff(
-		ng-if="!!history.diff && !history.diff.loading && !history.diff.deleted && !history.diff.error && !history.diff.binary"
+		ng-if="!!history.diff && !history.diff.loading && !history.diff.deleted && !history.diff.error && !openFile"
 	)
 	)
 		.toolbar.toolbar-alt
 		.toolbar.toolbar-alt
 			span.name
 			span.name

+ 6 - 2
services/web/frontend/js/ide/binary-files/BinaryFilesManager.js

@@ -26,7 +26,9 @@ export default BinaryFilesManager = class BinaryFilesManager {
 
 
   openFile(file) {
   openFile(file) {
     this.ide.fileTreeManager.selectEntity(file)
     this.ide.fileTreeManager.selectEntity(file)
-    this.$scope.ui.view = 'file'
+    if (this.$scope.ui.view !== 'history') {
+      this.$scope.ui.view = 'file'
+    }
     this.$scope.openFile = null
     this.$scope.openFile = null
     this.$scope.$apply()
     this.$scope.$apply()
     return window.setTimeout(
     return window.setTimeout(
@@ -46,7 +48,9 @@ export default BinaryFilesManager = class BinaryFilesManager {
     return window.setTimeout(
     return window.setTimeout(
       () => {
       () => {
         this.$scope.openFile = null
         this.$scope.openFile = null
-        this.$scope.ui.view = 'editor'
+        if (this.$scope.ui.view !== 'history') {
+          this.$scope.ui.view = 'editor'
+        }
         this.$scope.$apply()
         this.$scope.$apply()
       },
       },
       0,
       0,