Fix crash in MWExtensionNode creation mode

We can't get the directionality from the focused node if there isn't one.

This doesn't add any logic to determine the directionality in creation
mode, filed https://bugzilla.wikimedia.org/show_bug.cgi?id=57421 for that.

Change-Id: I3ff8d48f19c7beef5e24b55712a26d86efa5812a
This commit is contained in:
Roan Kattouw 2013-11-22 12:58:12 +00:00 committed by Catrope
parent e9ad0c7b36
commit 1f8d01b72e

View file

@ -66,10 +66,12 @@ ve.ui.MWExtensionInspector.prototype.setup = function ( data ) {
this.node = this.surface.getView().getFocusedNode();
this.input.setValue( this.node ? this.node.getModel().getAttribute( 'mw' ).body.extsrc : '' );
// Direction of the input textarea should correspond to the
// direction of the surrounding content of the node itself
// rather than the GUI direction:
this.input.setRTL( this.node.$element.css( 'direction' ) === 'rtl' );
if ( this.node ) {
// Direction of the input textarea should correspond to the
// direction of the surrounding content of the node itself
// rather than the GUI direction:
this.input.setRTL( this.node.$element.css( 'direction' ) === 'rtl' );
}
};
/**