From 86786bc947974d23149d9dfb7ccb9b3dd1f7e387 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 20 May 2018 11:58:50 +0200 Subject: [PATCH] CollabTarget: Pass import promise to setSynchronizer Depends-On: I188e749c315ddbb5f8779db10987178a51d27f5c Change-Id: I57fe6af459416e039274ea4c360e09a55123b024 --- modules/ve-mw-collab/ve.init.mw.CollabTarget.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js index d64c9e7218..bae9229fad 100644 --- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js +++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js @@ -118,12 +118,10 @@ ve.init.mw.CollabTarget.prototype.attachToolbar = function () { */ ve.init.mw.CollabTarget.prototype.setSurface = function ( surface ) { var synchronizer, surfaceView, defaultName, + importDeferred = $.Deferred(), target = this; if ( surface !== this.surface ) { - // TODO: Show 'connecting' progress bar until doc is ready - surface.getModel().setNullSelection(); - this.$editableContent.after( surface.$element ); surfaceView = surface.getView(); @@ -169,8 +167,9 @@ ve.init.mw.CollabTarget.prototype.setSurface = function ( surface ) { } ); initPromise.always( function () { surface.getModel().selectFirstContentOffset(); - // TODO: Hide 'connecting' progress bar - } ); // TODO: Handle .fail + // Resolve progress bar + importDeferred.resolve(); + } ); } ); // TODO: server could communicate with MW (via oauth?) to know the @@ -184,7 +183,7 @@ ve.init.mw.CollabTarget.prototype.setSurface = function ( surface ) { synchronizer.changeName( defaultName ); } - surfaceView.setSynchronizer( synchronizer ); + surfaceView.setSynchronizer( synchronizer, importDeferred.promise() ); } // Parent method