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

Merge pull request #6705 from overleaf/ta-ms-doc-too-long-modal

Improve handling of "Document Too Long" Errors

GitOrigin-RevId: 6a5e200014609e2a94f896840757487564d41176
Timothée Alby 4 лет назад
Родитель
Сommit
4a70dfa921
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      services/web/frontend/js/ide/editor/EditorManager.js

+ 8 - 2
services/web/frontend/js/ide/editor/EditorManager.js

@@ -40,6 +40,7 @@ export default EditorManager = (function () {
         opening: true,
         trackChanges: false,
         wantTrackChanges: false,
+        docTooLongErrorShown: false,
         showRichText: this.showRichText(),
         newSourceEditor: this.newSourceEditor(),
         showSymbolPalette: false,
@@ -334,16 +335,21 @@ export default EditorManager = (function () {
           message = ''
         }
         if (/maxDocLength/.test(message)) {
-          this.ide.showGenericMessageModal(
+          this.$scope.docTooLongErrorShown = true
+          this.openDoc(doc, { forceReopen: true })
+          const genericMessageModal = this.ide.showGenericMessageModal(
             'Document Too Long',
             'Sorry, this file is too long to be edited manually. Please upload it directly.'
           )
+          genericMessageModal.result.finally(() => {
+            this.$scope.docTooLongErrorShown = false
+          })
         } else if (/too many comments or tracked changes/.test(message)) {
           this.ide.showGenericMessageModal(
             'Too many comments or tracked changes',
             'Sorry, this file has too many comments or tracked changes. Please try accepting or rejecting some existing changes, or resolving and deleting some comments.'
           )
-        } else {
+        } else if (!this.$scope.docTooLongErrorShown) {
           // Do not allow this doc to open another error modal.
           sharejs_doc.off('error')