Media Dialog: make the alt field wrap and autosize for longer values

Bug: T349319
Change-Id: I60e0a9c85f24132651007b436f146be801e77ebb
This commit is contained in:
David Lynch 2023-10-19 14:29:26 -05:00 committed by Esanders
parent ba3229a943
commit e2a7592bab

View file

@ -230,9 +230,12 @@ ve.ui.MWMediaDialog.prototype.initialize = function () {
this.captionFieldset.addItems( [ captionField ] );
// Alt text
this.altTextInput = new OO.ui.TextInputWidget( {
this.altTextInput = new OO.ui.MultilineTextInputWidget( {
spellcheck: true,
classes: [ 've-ui-mwMediaDialog-altText' ]
classes: [ 've-ui-mwMediaDialog-altText' ],
autosize: true,
rows: 1,
allowLinebreaks: false
} );
var altTextField = new OO.ui.FieldLayout( this.altTextInput, {
align: 'top'
@ -1201,6 +1204,9 @@ ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel, noFocus ) {
// Focus the caption surface
this.captionTarget.focus();
}
// Auto-sized alt text field is populated while hidden,
// so force a manual resize now.
this.altTextInput.adjustSize( true );
break;
case 'search':
this.setSize( 'larger' );