mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-02 18:06:16 +00:00
Merge "Set mode of save dialog after setting size so footer is correct height"
This commit is contained in:
commit
7d227035d8
|
@ -174,6 +174,7 @@ ve.ui.MWSaveDialog.prototype.clearDiff = function () {
|
||||||
*/
|
*/
|
||||||
ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
||||||
var currentEditSummaryWikitext,
|
var currentEditSummaryWikitext,
|
||||||
|
mode = panel,
|
||||||
size = 'medium',
|
size = 'medium',
|
||||||
dialog = this,
|
dialog = this,
|
||||||
panelObj = dialog[ panel + 'Panel' ];
|
panelObj = dialog[ panel + 'Panel' ];
|
||||||
|
@ -200,19 +201,15 @@ ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
||||||
|
|
||||||
switch ( panel ) {
|
switch ( panel ) {
|
||||||
case 'save':
|
case 'save':
|
||||||
this.actions.setMode( 'save' );
|
|
||||||
// HACK: FF needs *another* defer
|
// HACK: FF needs *another* defer
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
dialog.editSummaryInput.moveCursorToEnd();
|
dialog.editSummaryInput.moveCursorToEnd();
|
||||||
} );
|
} );
|
||||||
break;
|
break;
|
||||||
case 'conflict':
|
case 'conflict':
|
||||||
this.actions
|
this.actions.setAbilities( { save: false } );
|
||||||
.setAbilities( { save: false } )
|
|
||||||
.setMode( 'conflict' );
|
|
||||||
break;
|
break;
|
||||||
case 'preview':
|
case 'preview':
|
||||||
this.actions.setMode( 'preview' );
|
|
||||||
size = 'full';
|
size = 'full';
|
||||||
break;
|
break;
|
||||||
case 'review':
|
case 'review':
|
||||||
|
@ -249,21 +246,24 @@ ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* falls through */
|
break;
|
||||||
case 'nochanges':
|
case 'nochanges':
|
||||||
this.actions.setMode( 'review' );
|
mode = 'review';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show the target panel
|
||||||
|
this.panels.setItem( panelObj );
|
||||||
|
this.setSize( size );
|
||||||
|
|
||||||
|
// Set mode after setting size so that the footer is measured correctly
|
||||||
|
this.actions.setMode( mode );
|
||||||
|
|
||||||
// Only show preview in source mode
|
// Only show preview in source mode
|
||||||
this.actions.forEach( { actions: 'preview' }, function ( action ) {
|
this.actions.forEach( { actions: 'preview' }, function ( action ) {
|
||||||
action.toggle( ve.init.target.mode === 'source' );
|
action.toggle( ve.init.target.mode === 'source' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Show the target panel
|
|
||||||
this.panels.setItem( panelObj );
|
|
||||||
this.setSize( size );
|
|
||||||
|
|
||||||
mw.hook( 've.saveDialog.stateChanged' ).fire();
|
mw.hook( 've.saveDialog.stateChanged' ).fire();
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
|
|
Loading…
Reference in a new issue