Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/258468

Change subject: [BREAKING CHANGE] ve.init.Target: Upstream the action toolbar 
from sa/mw desktop targets
......................................................................

[BREAKING CHANGE] ve.init.Target: Upstream the action toolbar from sa/mw 
desktop targets

Change-Id: I272175dff3a7aa6c4c94e7d9f6288911f2829a94
---
M src/init/sa/ve.init.sa.DesktopTarget.js
M src/init/ve.init.Target.js
2 files changed, 21 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/68/258468/1

diff --git a/src/init/sa/ve.init.sa.DesktopTarget.js 
b/src/init/sa/ve.init.sa.DesktopTarget.js
index cf2f3bf..0f97bb7 100644
--- a/src/init/sa/ve.init.sa.DesktopTarget.js
+++ b/src/init/sa/ve.init.sa.DesktopTarget.js
@@ -30,23 +30,6 @@
 /**
  * @inheritdoc
  */
-ve.init.sa.DesktopTarget.prototype.setupToolbar = function ( surface ) {
-       if ( !this.actions ) {
-               this.actions = new ve.ui.TargetToolbar( this );
-       }
-
-       // Parent method
-       ve.init.sa.DesktopTarget.super.prototype.setupToolbar.call( this, 
surface );
-
-       this.actions.setup( this.constructor.static.actionGroups, surface );
-       this.getToolbar().$actions.append( this.actions.$element );
-       this.actions.initialize();
-
-};
-
-/**
- * @inheritdoc
- */
 ve.init.sa.DesktopTarget.prototype.destroy = function () {
        if ( this.actions ) {
                this.actions.destroy();
diff --git a/src/init/ve.init.Target.js b/src/init/ve.init.Target.js
index 8555926..e200b2c 100644
--- a/src/init/ve.init.Target.js
+++ b/src/init/ve.init.Target.js
@@ -35,6 +35,7 @@
        this.surfaces = [];
        this.surface = null;
        this.toolbar = null;
+       this.actionsToolbar = null;
        this.toolbarConfig = config.toolbarConfig;
        this.commandRegistry = config.commandRegistry || ve.ui.commandRegistry;
        this.sequenceRegistry = config.sequenceRegistry || 
ve.ui.sequenceRegistry;
@@ -127,6 +128,8 @@
                demote: [ 'deleteTable' ]
        }
 ];
+
+ve.init.Target.static.actionGroups = [];
 
 /**
  * List of commands which can be triggered anywhere from within the document
@@ -438,19 +441,35 @@
 };
 
 /**
+ * Get the actions toolbar
+ *
+ * @return {ve.ui.TargetToolbar} Actions toolbar
+ */
+ve.init.Target.prototype.getActions = function () {
+       if ( !this.actionsToolbar ) {
+               this.actionsToolbar = new ve.ui.TargetToolbar( this );
+       }
+       return this.actionsToolbar;
+};
+
+/**
  * Set up the toolbar, attaching it to a surface.
  *
  * @param {ve.ui.Surface} surface Surface
  */
 ve.init.Target.prototype.setupToolbar = function ( surface ) {
-       var toolbar = this.getToolbar();
+       var toolbar = this.getToolbar(),
+               actions = this.getActions();
 
        toolbar.connect( this, { resize: 'onToolbarResize' } );
 
        toolbar.setup( this.constructor.static.toolbarGroups, surface );
+       actions.setup( this.constructor.static.actionGroups, surface );
        this.attachToolbar( surface );
        toolbar.$bar.append( surface.getToolbarDialogs().$element );
+       toolbar.$actions.append( actions.$element );
        this.onContainerScroll();
+
 };
 
 /**
@@ -459,4 +478,5 @@
 ve.init.Target.prototype.attachToolbar = function () {
        this.getToolbar().$element.insertBefore( 
this.getToolbar().getSurface().$element );
        this.getToolbar().initialize();
+       this.getActions().initialize();
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I272175dff3a7aa6c4c94e7d9f6288911f2829a94
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to