jenkins-bot has submitted this change and it was merged.

Change subject: Update VE core submodule to master (cf1e167)
......................................................................


Update VE core submodule to master (cf1e167)

New changes:
776e801 Delimit text nodes in debug observations
72643bc Remove debug bar hiding now it is handled by the surface
cf1e167 [BREAKING CHANGE] Multiple surface support and demo

Local changes:
Account for detachable toolbars in core being setup in a different order.

Change-Id: I29156948711d55ba5f6dd4f6c35ca0e4cca32373
---
M lib/ve
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
M modules/ve-mw/tests/ve.test.utils.js
4 files changed, 31 insertions(+), 36 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/ve b/lib/ve
index 26f44bc..cf1e167 160000
--- a/lib/ve
+++ b/lib/ve
-Subproject commit 26f44bc486c293d7cabd10a5020bc0d195d0285e
+Subproject commit cf1e167880693a8f1b97812e128720fe5e587b5c
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 854cc53..68054f9 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -184,10 +184,10 @@
 /**
  * @inheritdoc
  */
-ve.init.mw.ViewPageTarget.prototype.setupToolbar = function () {
+ve.init.mw.ViewPageTarget.prototype.setupToolbar = function ( surface ) {
        var $firstHeading;
        // Parent method
-       ve.init.mw.Target.prototype.setupToolbar.call( this );
+       ve.init.mw.Target.prototype.setupToolbar.call( this, surface );
 
        // Keep it hidden so that we can slide it down smoothly (avoids sudden
        // offset flash when original content is hidden, and replaced in-place 
with a
@@ -196,22 +196,21 @@
        // to target (visibly), only for us to hide it again 0ms later.
        // Though we can't hide it by default because it needs visible 
dimensions
        // to compute stuff during setup.
-       this.toolbar.$bar.hide();
+       this.getToolbar().$bar.hide();
 
-       this.toolbar.enableFloatable();
-       this.toolbar.$element
+       this.getToolbar().$element
                .addClass( 've-init-mw-viewPageTarget-toolbar' );
 
        // Move the toolbar to before #firstHeading if it exists
        $firstHeading = $( '#firstHeading' );
        if ( $firstHeading.length ) {
-               this.toolbar.$element.insertBefore( $firstHeading );
+               this.getToolbar().$element.insertBefore( $firstHeading );
        }
 
-       this.toolbar.$bar.slideDown( 'fast', function () {
+       this.getToolbar().$bar.slideDown( 'fast', function () {
                // Check the surface wasn't torn down while the toolbar was 
animating
                if ( this.getSurface() ) {
-                       this.toolbar.initialize();
+                       this.getToolbar().initialize();
                        this.getSurface().getView().emit( 'position' );
                        this.getSurface().getContext().updateDimensions();
                }
@@ -349,7 +348,7 @@
                // button property (bug 46456)
                this.toolbarSaveButton.disconnect( this );
                this.toolbarSaveButton.$element.detach();
-               this.toolbar.$actions.empty();
+               this.getToolbar().$actions.empty();
        }
 
        // Check we got as far as setting up the surface
@@ -1111,7 +1110,7 @@
 ve.init.mw.ViewPageTarget.prototype.attachToolbarSaveButton = function () {
        var $actionTools = $( '<div>' ),
                $pushButtons = $( '<div>' ),
-               actions = new ve.ui.TargetToolbar( this, this.getSurface() );
+               actions = new ve.ui.TargetToolbar( this );
 
        actions.setup( [
                { include: [ 'help', 'notices' ] },
@@ -1121,7 +1120,7 @@
                        title: ve.msg( 'visualeditor-pagemenu-tooltip' ),
                        include: [ 'meta', 'settings', 'advancedSettings', 
'categories', 'languages', 'editModeSource', 'findAndReplace' ]
                }
-       ] );
+       ], this.getSurface() );
 
        $actionTools
                .addClass( 've-init-mw-viewPageTarget-toolbar-utilities' )
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 41e1b63..ba287e8 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -20,10 +20,10 @@
  *  revision id here. Defaults to loading the latest version (see #load).
  */
 ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId 
) {
-       var conf = mw.config.get( 'wgVisualEditorConfig' );
-
        // Parent constructor
-       ve.init.Target.call( this, $container );
+       ve.init.Target.call( this, $container, { shadow: true, actions: true, 
floatable: true } );
+
+       var conf = mw.config.get( 'wgVisualEditorConfig' );
 
        // Properties
        this.pageName = pageName;
@@ -1368,16 +1368,18 @@
                setTimeout( function () {
                        // Create ui.Surface (also creates ce.Surface and 
dm.Surface and builds CE tree)
                        var surface = target.addSurface( dmDoc );
-                       surface.$element.addClass( 
've-init-mw-viewPageTarget-surface' )
-                               .addClass( target.protectedClasses );
+                       surface.$element
+                               .addClass( 've-init-mw-viewPageTarget-surface' )
+                               .addClass( target.protectedClasses )
+                               .appendTo( target.$element );
+                       target.setSurface( surface );
+
                        setTimeout( function () {
                                var surfaceView = surface.getView(),
                                        $documentNode = 
surfaceView.getDocument().getDocumentNode().$element;
 
                                // Initialize surface
                                surface.getContext().toggle( false );
-                               target.$element.append( surface.$element );
-                               target.setupToolbar();
 
                                // Apply mw-body-content to the view 
(ve-ce-surface).
                                // Not to surface (ve-ui-surface), since that 
contains both the view
@@ -1399,14 +1401,6 @@
 };
 
 /**
- * @inheritdoc
- */
-ve.init.mw.Target.prototype.setupToolbar = function () {
-       // Parent method
-       ve.init.Target.prototype.setupToolbar.call( this, { shadow: true, 
actions: true } );
-};
-
-/**
  * Fire off the sanity check. Must be called before the surface is activated.
  *
  * To access the result, check whether #sanityCheckPromise has been resolved 
or rejected
@@ -1419,14 +1413,14 @@
        // We have to get a copy of the data now, before we unlock the surface 
and let the user edit,
        // but we can defer the actual conversion and comparison
        var target = this,
-               doc = target.surface.getModel().getDocument(),
+               doc = this.getSurface().getModel().getDocument(),
                data = new ve.dm.FlatLinearData( doc.getStore().clone(), 
ve.copy( doc.getFullData() ) ),
-               oldDom = target.doc,
+               oldDom = this.doc,
                d = $.Deferred();
 
        // Reset
-       target.sanityCheckFinished = false;
-       target.sanityCheckVerified = false;
+       this.sanityCheckFinished = false;
+       this.sanityCheckVerified = false;
 
        setTimeout( function () {
                // We can't compare oldDom.body and newDom.body directly, 
because the attributes on the
@@ -1453,7 +1447,7 @@
                d.resolve();
        } );
 
-       target.sanityCheckPromise = d.promise()
+       this.sanityCheckPromise = d.promise()
                .done( function () {
                        // If we detect no roundtrip errors,
                        // don't emphasize "review changes" to the user.
@@ -1501,7 +1495,7 @@
        var nextNode, offset,
                target = this,
                offsetNode = headingNode,
-               surfaceModel = this.surface.getView().getModel(),
+               surfaceModel = this.getSurface().getView().getModel(),
                lastHeadingLevel = -1;
 
        // Find next sibling which isn't a heading
@@ -1519,7 +1513,7 @@
        );
        // onDocumentFocus is debounced, so wait for that to happen before 
setting
        // the model selection, otherwise it will get reset
-       this.surface.getView().once( 'focus', function () {
+       this.getSurface().getView().once( 'focus', function () {
                surfaceModel.setLinearSelection( new ve.Range( offset ) );
                target.scrollToHeading( headingNode );
        } );
@@ -1534,5 +1528,5 @@
 ve.init.mw.Target.prototype.scrollToHeading = function ( headingNode ) {
        var $window = $( OO.ui.Element.static.getWindow( this.$element ) );
 
-       $window.scrollTop( headingNode.$element.offset().top - 
this.toolbar.$element.height() );
+       $window.scrollTop( headingNode.$element.offset().top - 
this.getToolbar().$element.height() );
 };
diff --git a/modules/ve-mw/tests/ve.test.utils.js 
b/modules/ve-mw/tests/ve.test.utils.js
index 92a6083..be51a62 100644
--- a/modules/ve-mw/tests/ve.test.utils.js
+++ b/modules/ve-mw/tests/ve.test.utils.js
@@ -10,11 +10,13 @@
        ve.init.platform.initialized = $.Deferred();
        // HACK: MW targets are async and heavy, use an SA target but
        // override the global registration
-       var target = new ve.init.sa.Target( $( '#qunit-fixture' ), doc ),
+       var target = new ve.init.sa.Target( $( '#qunit-fixture' ) ),
                mwTarget = new ve.init.mw.Target( $( '<div>' ).appendTo( $( 
'#qunit-fixture' ) ) );
+
+       target.addSurface( doc );
 
        ve.init.platform.initialized.resolve();
        mwTarget = null;
-       target.setup( doc );
+       target.addSurface( doc );
        return target.surface;
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I29156948711d55ba5f6dd4f6c35ca0e4cca32373
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to