Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354870 )

Change subject: rebaser: Move synchronizer/authorList to Target from Target.init
......................................................................

rebaser: Move synchronizer/authorList to Target from Target.init

Change-Id: I828ab12662e03cf674e20ae5676ca6eaa2592eba
---
M modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js
M modules/ve-mw-collab/ve.init.mw.CollabTarget.js
2 files changed, 28 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/70/354870/1

diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js 
b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js
index ecf090b..9457daf 100644
--- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js
+++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js
@@ -35,7 +35,7 @@
                documentNameField.toggle( false );
 
                loadingPromise.done( function () {
-                       target = ve.init.mw.targetFactory.create( 'collab' );
+                       target = ve.init.mw.targetFactory.create( 'collab', 
title, conf.rebaserUrl );
 
                        $( 'body' ).addClass( 've-activated ve-active' );
 
@@ -45,18 +45,6 @@
                        $( '#firstHeading' ).addClass( 
've-init-mw-desktopArticleTarget-uneditableContent' );
 
                        target.documentReady( ve.createDocumentFromHtml( '' ) );
-                       target.once( 'surfaceReady', function () {
-                               var synchronizer = new 
ve.dm.SurfaceSynchronizer(
-                                               target.getSurface().getModel(),
-                                               title.toString(),
-                                               { server: conf.rebaserUrl }
-                                       ),
-                                       authorList = new 
ve.ui.AuthorListWidget( synchronizer );
-
-                               target.getToolbar().$actions.append( 
authorList.$element );
-                               target.getSurface().getView().setSynchronizer( 
synchronizer );
-                               target.getSurface().getView().focus();
-                       } );
                } ).always( function () {
                        documentNameField.toggle( false );
                        progressBar.toggle( false );
diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js 
b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
index 6c579cf..841ab0f 100644
--- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
+++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
@@ -12,15 +12,20 @@
  * @extends ve.init.mw.Target
  *
  * @constructor
+ * @param {mw.Title} title Page sub-title
+ * @param {rebaserUrl} string Rebaser server URL
  * @param {Object} [config] Configuration options
  */
-ve.init.mw.CollabTarget = function VeInitMwCollabTarget( config ) {
+ve.init.mw.CollabTarget = function VeInitMwCollabTarget( title, rebaserUrl, 
config ) {
        config = config || {};
        config.toolbarConfig = $.extend( {
                shadow: true,
                actions: true,
                floatable: true
        }, config.toolbarConfig );
+
+       this.title = title;
+       this.rebaserUrl = rebaserUrl;
 
        // Parent constructor
        ve.init.mw.CollabTarget.super.call( this, config );
@@ -58,6 +63,27 @@
        this.$element.parent().append( this.$originalContent.children() );
 };
 
+/**
+ * @inheritdoc
+ */
+ve.init.mw.CollabTarget.prototype.surfaceReady = function () {
+       var synchronizer, authorList,
+               surfaceView = this.getSurface().getView();
+
+       // Parent method
+       ve.init.mw.CollabTarget.super.prototype.surfaceReady.apply( this, 
arguments );
+
+       synchronizer = new ve.dm.SurfaceSynchronizer(
+               this.getSurface().getModel(),
+               this.title.toString(),
+               { server: this.rebaserUrl }
+       );
+       authorList = new ve.ui.AuthorListWidget( synchronizer );
+
+       this.getToolbar().$actions.append( authorList.$element );
+       surfaceView.setSynchronizer( synchronizer );
+       surfaceView.focus();
+};
 
 /**
  * @inheritdoc

-- 
To view, visit https://gerrit.wikimedia.org/r/354870
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I828ab12662e03cf674e20ae5676ca6eaa2592eba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to