mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-26 04:53:04 +00:00
b74aa4160b
Currently it steals focus it doesn't use an iFrame, so we can't use it in this way. Change-Id: I4df95f3b60bc63b0ce296a06da648e96d94bf20f
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface LanguageInputWidget class.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.MWLanguageInputWidget object.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.LanguageInputWidget
|
|
*
|
|
* @constructor
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWLanguageInputWidget = function VeUiMWLanguageInputWidget( config ) {
|
|
// Parent constructor
|
|
ve.ui.LanguageInputWidget.call( this, config );
|
|
|
|
var changeButton = new OO.ui.ButtonWidget( {
|
|
'label': ve.msg( 'visualeditor-languageinspector-widget-changelang' ),
|
|
// Add 'href' so the button returns true on click and triggers ULS
|
|
'href': '#',
|
|
'flags': ['primary']
|
|
} );
|
|
|
|
// Events
|
|
changeButton.$element.uls( {
|
|
'onSelect': ve.bind( function ( language ) {
|
|
this.setAnnotationFromValues( language, $.uls.data.getDir( language ) );
|
|
}, this ),
|
|
'compact': true,
|
|
// Temporary Quicklist for the Prototype:
|
|
// (This will likely change once we find a better list)
|
|
'quickList': [ 'en', 'hi', 'he', 'ml', 'ta', 'fr' ]
|
|
} );
|
|
|
|
// TODO: Rethink the layout, maybe integrate the change button into the language field
|
|
// TODO: Consider using getAutonym to display a nicer language name label somewhere
|
|
|
|
// Initialization
|
|
// TODO: Re-enable when we've worked out a way to prevent ULS form stealing focus
|
|
// this.$element.prepend( $( '<div>' ).addClass( 've-ui-mwLangugageInputWidget-uls' ).append( changeButton.$element ) );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWLanguageInputWidget, ve.ui.LanguageInputWidget );
|