Catrope has uploaded a new change for review.

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

Change subject: Followup cf1e167: unbreak SurfaceWidget
......................................................................

Followup cf1e167: unbreak SurfaceWidget

SurfaceWidget needs to pass a reference to the surface
when setting up the toolbar.

Also reverse the order of operations in the ve.ui.Toolbar
destructor. Individual tools' destructors call .getSurface()
on the toolbar, so we have to unbind the surface after
destroying the tools, not before.

Change-Id: I5005a33be44abf062608fad0ac52c41e135e6ee7
---
M src/ui/ve.ui.Toolbar.js
M src/ui/widgets/ve.ui.SurfaceWidget.js
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/02/179202/1

diff --git a/src/ui/ve.ui.Toolbar.js b/src/ui/ve.ui.Toolbar.js
index 9c7dea1..ccd8c1f 100644
--- a/src/ui/ve.ui.Toolbar.js
+++ b/src/ui/ve.ui.Toolbar.js
@@ -303,10 +303,11 @@
  * Call this whenever you are done using a toolbar.
  */
 ve.ui.Toolbar.prototype.destroy = function () {
-       this.detach();
-
        // Parent method
        OO.ui.Toolbar.prototype.destroy.call( this );
+
+       // Detach surface last, because tool destructors need getSurface()
+       this.detach();
 };
 
 /**
diff --git a/src/ui/widgets/ve.ui.SurfaceWidget.js 
b/src/ui/widgets/ve.ui.SurfaceWidget.js
index c18fd59..a03d8fb 100644
--- a/src/ui/widgets/ve.ui.SurfaceWidget.js
+++ b/src/ui/widgets/ve.ui.SurfaceWidget.js
@@ -40,7 +40,7 @@
                .addClass( 've-ui-surfaceWidget' )
                .append( this.toolbar.$element, this.surface.$element );
        if ( config.tools ) {
-               this.toolbar.setup( config.tools );
+               this.toolbar.setup( config.tools, this.surface );
        }
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5005a33be44abf062608fad0ac52c41e135e6ee7
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to