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

Merge pull request #3478 from overleaf/jpa-preseve-out-of-sync-trigger

[frontend] preserve the error handler that powers the out-of-sync modal

GitOrigin-RevId: 759ede691658d42cedec7c984b284e45d5c776e9
Brian Gough 5 лет назад
Родитель
Сommit
62dd773629
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      services/web/frontend/js/ide/editor/EditorManager.js

+ 7 - 1
services/web/frontend/js/ide/editor/EditorManager.js

@@ -221,6 +221,8 @@ export default (EditorManager = (function() {
 
         // Do not trigger any UI changes from remote operations
         this._unbindFromDocumentEvents(current_sharejs_doc)
+        // Keep listening for out-of-sync and similar errors.
+        this._attachErrorHandlerToDocument(doc, current_sharejs_doc)
 
         // Teardown the Document -> ShareJsDoc -> sharejs doc
         // By the time this completes, the Document instance is no longer
@@ -278,7 +280,7 @@ export default (EditorManager = (function() {
       })
     }
 
-    _bindToDocumentEvents(doc, sharejs_doc) {
+    _attachErrorHandlerToDocument(doc, sharejs_doc) {
       sharejs_doc.on('error', (error, meta, editorContent) => {
         let message
         if ((error != null ? error.message : undefined) != null) {
@@ -314,6 +316,10 @@ export default (EditorManager = (function() {
           removeHandler()
         })
       })
+    }
+
+    _bindToDocumentEvents(doc, sharejs_doc) {
+      this._attachErrorHandlerToDocument(doc, sharejs_doc)
 
       return sharejs_doc.on('externalUpdate', update => {
         if (this._ignoreExternalUpdates) {