CollabTarget: Pass import promise to setSynchronizer

Depends-On: I188e749c315ddbb5f8779db10987178a51d27f5c
Change-Id: I57fe6af459416e039274ea4c360e09a55123b024
This commit is contained in:
Ed Sanders 2018-05-20 11:58:50 +02:00 committed by Jforrester
parent 862486fe2f
commit 86786bc947

View file

@ -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