/*!
- * OOjs UI v0.19.0
+ * OOjs UI v0.19.1
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2017 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2017-02-01T23:04:40Z
+ * Date: 2017-02-08T00:38:31Z
*/
( function ( OO ) {
* }
* OO.inheritClass( MyProcessDialog, OO.ui.ProcessDialog );
* MyProcessDialog.static.title = 'An action set in a process dialog';
+ * MyProcessDialog.static.name = 'myProcessDialog';
* // An action set that uses modes ('edit' and 'help' mode, in this example).
* MyProcessDialog.static.actions = [
* { action: 'continue', modes: 'edit', label: 'Continue', flags: [ 'primary', 'constructive' ] },
* See the [OOjs ui documentation on MediaWiki] [2] for examples.
* [2]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
*
+ * This function can be called in two manners:
+ *
+ * 1. `.addWindows( [ windowA, windowB, ... ] )` (where `windowA`, `windowB` are OO.ui.Window objects)
+ *
+ * This syntax registers windows under the symbolic names defined in their `.static.name`
+ * properties. For example, if `windowA.constructor.static.name` is `'nameA'`, calling
+ * `.openWindow( 'nameA' )` afterwards will open the window `windowA`. This syntax requires the
+ * static name to be set, otherwise an exception will be thrown.
+ *
+ * This is the recommended way, as it allows for an easier switch to using a window factory.
+ *
+ * 2. `.addWindows( { nameA: windowA, nameB: windowB, ... } )`
+ *
+ * This syntax registers windows under the explicitly given symbolic names. In this example,
+ * calling `.openWindow( 'nameA' )` afterwards will open the window `windowA`, regardless of what
+ * its `.static.name` is set to. The static name is not required to be set.
+ *
+ * This should only be used if you need to override the default symbolic names.
+ *
+ * Example:
+ *
+ * var windowManager = new OO.ui.WindowManager();
+ * $( 'body' ).append( windowManager.$element );
+ *
+ * // Add a window under the default name: see OO.ui.MessageDialog.static.name
+ * windowManager.addWindows( [ new OO.ui.MessageDialog() ] );
+ * // Add a window under an explicit name
+ * windowManager.addWindows( { myMessageDialog: new OO.ui.MessageDialog() } );
+ *
+ * // Open window by default name
+ * windowManager.openWindow( 'message' );
+ * // Open window by explicitly given name
+ * windowManager.openWindow( 'myMessageDialog' );
+ *
+ *
* @param {Object.<string,OO.ui.Window>|OO.ui.Window[]} windows An array of window objects specified
* by reference, symbolic name, or explicitly defined symbolic names.
* @throws {Error} An error is thrown if a window is added by symbolic name, but has neither an
* MyDialog.parent.call( this, config );
* }
* OO.inheritClass( MyDialog, OO.ui.Dialog );
+ * MyDialog.static.name = 'myDialog';
* MyDialog.prototype.initialize = function () {
* MyDialog.parent.prototype.initialize.call( this );
* this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } );
this.executeAction( '' );
e.preventDefault();
e.stopPropagation();
- } else if ( e.which === OO.ui.Keys.ENTER && e.ctrlKey ) {
+ } else if ( e.which === OO.ui.Keys.ENTER && ( e.ctrlKey || e.metaKey ) ) {
actions = this.actions.get( { flags: 'primary', visible: true, disabled: false } );
if ( actions.length > 0 ) {
this.executeAction( actions[ 0 ].getAction() );
/* Static Properties */
+/**
+ * @static
+ * @inheritdoc
+ */
OO.ui.MessageDialog.static.name = 'message';
+/**
+ * @static
+ * @inheritdoc
+ */
OO.ui.MessageDialog.static.size = 'small';
-// @deprecated since v0.18.4 as default; TODO: Remove
+/**
+ * @static
+ * @deprecated since v0.18.4 as default; TODO: Remove
+ */
OO.ui.MessageDialog.static.verbose = true;
/**
*/
OO.ui.MessageDialog.static.message = null;
-// Note that OO.ui.alert() and OO.ui.confirm() rely on these.
+/**
+ * @static
+ * @inheritdoc
+ */
OO.ui.MessageDialog.static.actions = [
+ // Note that OO.ui.alert() and OO.ui.confirm() rely on these.
{ action: 'accept', label: OO.ui.deferMsg( 'ooui-dialog-message-accept' ), flags: 'primary' },
{ action: 'reject', label: OO.ui.deferMsg( 'ooui-dialog-message-reject' ), flags: 'safe' }
];
* }
* OO.inheritClass( MyProcessDialog, OO.ui.ProcessDialog );
*
+ * MyProcessDialog.static.name = 'myProcessDialog';
* MyProcessDialog.static.title = 'Process dialog';
* MyProcessDialog.static.actions = [
* { action: 'save', label: 'Done', flags: 'primary' },
if ( !OO.ui.windowManager ) {
OO.ui.windowManager = new OO.ui.WindowManager();
$( 'body' ).append( OO.ui.windowManager.$element );
- OO.ui.windowManager.addWindows( {
- messageDialog: new OO.ui.MessageDialog()
- } );
+ OO.ui.windowManager.addWindows( [ new OO.ui.MessageDialog() ] );
}
return OO.ui.windowManager;
};
* @return {jQuery.Promise} Promise resolved when the user closes the dialog
*/
OO.ui.alert = function ( text, options ) {
- return OO.ui.getWindowManager().openWindow( 'messageDialog', $.extend( {
+ return OO.ui.getWindowManager().openWindow( 'message', $.extend( {
message: text,
actions: [ OO.ui.MessageDialog.static.actions[ 0 ] ]
}, options ) ).then( function ( opened ) {
* `false`.
*/
OO.ui.confirm = function ( text, options ) {
- return OO.ui.getWindowManager().openWindow( 'messageDialog', $.extend( {
+ return OO.ui.getWindowManager().openWindow( 'message', $.extend( {
message: text
}, options ) ).then( function ( opened ) {
return opened.then( function ( closing ) {
*
* @param {jQuery|string} text Message text to display
* @param {Object} [options] Additional options, see OO.ui.MessageDialog#getSetupProcess
- * @cfg {Object} [textInput] Additional options for text input widget, see OO.ui.TextInputWidget
+ * @param {Object} [options.textInput] Additional options for text input widget, see OO.ui.TextInputWidget
* @return {jQuery.Promise} Promise resolved when the user closes the dialog. If the user chose to
* confirm, the promise will resolve with the value of the text input widget; otherwise, it will
* resolve to `null`.
// TODO: This is a little hacky, and could be done by extending MessageDialog instead.
- return manager.openWindow( 'messageDialog', $.extend( {
+ return manager.openWindow( 'message', $.extend( {
message: textField.$element
}, options ) ).then( function ( opened ) {
// After ready