From 4a70dfa9210610c75d78d4b2d22033bd010ddd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Tue, 15 Feb 2022 14:37:46 +0100 Subject: [PATCH] Merge pull request #6705 from overleaf/ta-ms-doc-too-long-modal Improve handling of "Document Too Long" Errors GitOrigin-RevId: 6a5e200014609e2a94f896840757487564d41176 --- services/web/frontend/js/ide/editor/EditorManager.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/ide/editor/EditorManager.js b/services/web/frontend/js/ide/editor/EditorManager.js index 0a19ab4621..22da1af7cc 100644 --- a/services/web/frontend/js/ide/editor/EditorManager.js +++ b/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')