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

Improve handling of "Document Too Long" Errors

GitOrigin-RevId: 6a5e200014609e2a94f896840757487564d41176
This commit is contained in:
Timothée Alby 2022-02-15 14:37:46 +01:00 committed by Copybot
parent 9049691f42
commit 4a70dfa921

View file

@ -40,6 +40,7 @@ export default EditorManager = (function () {
opening: true, opening: true,
trackChanges: false, trackChanges: false,
wantTrackChanges: false, wantTrackChanges: false,
docTooLongErrorShown: false,
showRichText: this.showRichText(), showRichText: this.showRichText(),
newSourceEditor: this.newSourceEditor(), newSourceEditor: this.newSourceEditor(),
showSymbolPalette: false, showSymbolPalette: false,
@ -334,16 +335,21 @@ export default EditorManager = (function () {
message = '' message = ''
} }
if (/maxDocLength/.test(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', 'Document Too Long',
'Sorry, this file is too long to be edited manually. Please upload it directly.' '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)) { } else if (/too many comments or tracked changes/.test(message)) {
this.ide.showGenericMessageModal( this.ide.showGenericMessageModal(
'Too many comments or tracked changes', '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.' '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. // Do not allow this doc to open another error modal.
sharejs_doc.off('error') sharejs_doc.off('error')