| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
mw.libs.ve = mw.libs.ve || {}; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
mw.libs.ve.EditingTabDialog = function MWLibsVEMWEditingTabDialog( config ) { |
| 19 |
|
| 20 |
mw.libs.ve.EditingTabDialog.super.call( this, config ); |
| 21 |
}; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
OO.inheritClass( mw.libs.ve.EditingTabDialog, OO.ui.MessageDialog ); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
mw.libs.ve.EditingTabDialog.static.name = 'editingtab'; |
| 30 |
|
| 31 |
mw.libs.ve.EditingTabDialog.static.size = 'medium'; |
| 32 |
|
| 33 |
mw.libs.ve.EditingTabDialog.static.title = mw.msg( 'visualeditor-editingtabdialog-title' ); |
| 34 |
|
| 35 |
mw.libs.ve.EditingTabDialog.static.message = mw.msg( 'visualeditor-editingtabdialog-body' ); |
| 36 |
|
| 37 |
mw.libs.ve.EditingTabDialog.static.actions = [ |
| 38 |
|
| 39 |
{ |
| 40 |
action: 'prefer-wt', |
| 41 |
label: mw.msg( 'visualeditor-preference-tabs-prefer-wt' ) |
| 42 |
}, |
| 43 |
{ |
| 44 |
action: 'prefer-ve', |
| 45 |
label: mw.msg( 'visualeditor-preference-tabs-prefer-ve' ) |
| 46 |
}, |
| 47 |
{ |
| 48 |
action: 'multi-tab', |
| 49 |
label: mw.msg( 'visualeditor-preference-tabs-multi-tab' ) |
| 50 |
}, |
| 51 |
{ |
| 52 |
label: mw.msg( 'visualeditor-editingtabdialog-ok' ), |
| 53 |
flags: [ 'progressive', 'primary' ] |
| 54 |
} |
| 55 |
]; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
mw.libs.ve.EditingTabDialog.prototype.getSetupProcess = function ( action ) { |
| 63 |
return mw.libs.ve.EditingTabDialog.super.prototype.getSetupProcess.call( this, action ) |
| 64 |
.next( () => { |
| 65 |
|
| 66 |
new mw.Api().saveOption( 'visualeditor-hidetabdialog', 1 ); |
| 67 |
mw.user.options.set( 'visualeditor-hidetabdialog', 1 ); |
| 68 |
} ); |
| 69 |
}; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
mw.libs.ve.EditingTabDialog.prototype.getActionProcess = function ( action ) { |
| 75 |
if ( action ) { |
| 76 |
return new OO.ui.Process( () => { |
| 77 |
const actionWidget = this.getActions().get( { actions: action } )[ 0 ]; |
| 78 |
actionWidget.pushPending(); |
| 79 |
this.pushPending(); |
| 80 |
|
| 81 |
|
| 82 |
new mw.Api().saveOption( 'visualeditor-tabs', action ).done( () => { |
| 83 |
actionWidget.popPending(); |
| 84 |
mw.user.options.set( 'visualeditor-tabs', action ); |
| 85 |
this.close( { action: action } ); |
| 86 |
} ); |
| 87 |
} ); |
| 88 |
} else { |
| 89 |
|
| 90 |
return mw.libs.ve.EditingTabDialog.super.prototype.getActionProcess.call( this, action ); |
| 91 |
} |
| 92 |
}; |