Jiabao has uploaded a new change for review.

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


Change subject: Math Node UI (Bug Fix)
......................................................................

Math Node UI (Bug Fix)

Fixed two bugs found after merging:

1. Open the Math node inspector without
editting anything, then click somewhere
else on the page, it will crush.

2. Similarly, open the Math node inspector
without editting anything, then click
the "Cancel" button to cancel the edit,
it will crush.

Both of them are fixed by this patch.
The issue was with using getFocusedNode()
in the inspector onClose function to save
changes.

Also some minor change according to the
last code review. =D

Change-Id: I6e200f2a228b71dc5af5aa9843c461f43b926f8d
---
M modules/ve-mw/ui/inspectors/ve.ui.MWMathInspector.js
1 file changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWMathInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWMathInspector.js
index 41fdac8..62397d8 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWMathInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWMathInspector.js
@@ -57,10 +57,12 @@
  */
 ve.ui.MWMathInspector.prototype.onOpen = function () {
 
-       var src = 
this.surface.getView().getFocusedNode().getModel().getAttribute( 'extsrc' );
-
        // Parent method
        ve.ui.Inspector.prototype.onOpen.call( this );
+
+       this.mathNode = this.surface.getView().getFocusedNode();
+
+       var src = this.mathNode.getModel().getAttribute( 'extsrc' );
 
        // Wait for animation to complete
        setTimeout( ve.bind( function () {
@@ -80,12 +82,11 @@
        ve.ui.Inspector.prototype.onClose.call( this, action );
 
        var newsrc = this.input.getValue(),
-               surfaceModel = this.surface.getModel(),
-               mathNode = this.surface.getView().getFocusedNode().getModel();
+               surfaceModel = this.surface.getModel();
 
        surfaceModel.change(
                ve.dm.Transaction.newFromAttributeChanges(
-                       surfaceModel.getDocument(), 
mathNode.getOuterRange().start, { 'extsrc': newsrc }
+                       surfaceModel.getDocument(), 
this.mathNode.getOuterRange().start, { 'extsrc': newsrc }
                )
        );
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e200f2a228b71dc5af5aa9843c461f43b926f8d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jiabao <jiabao.f...@gmail.com>

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

Reply via email to