Page MenuHomePhabricator

Gallery dialog caption field should be a multi-line input
Closed, ResolvedPublic1 Estimated Story Points

Description

Some captions can be quite long:

pasted_file (666×725 px, 204 KB)

Event Timeline

Change 297612 had a related patch set uploaded (by Tchanders):
Make gallery dialog caption field multiline

https://gerrit.wikimedia.org/r/297612

You can't have multiline gallery captions in wikitext though…

Change 297612 merged by jenkins-bot:
Make gallery dialog caption field multiline

https://gerrit.wikimedia.org/r/297612

@matmarex Good point - I think the multiline input is useful for seeing the whole caption at once if it's long, but we could prevent entering line breaks?

We have the same problem in the save dialog, and solve it using the inputFilter option, and a keypress handler:

this.editSummaryInput = new OO.ui.TextInputWidget( {
	multiline: true,
	placeholder: ve.msg( 'visualeditor-editsummary' ),
	classes: [ 've-ui-mwSaveDialog-summary' ],
	inputFilter: function ( value ) {
		// Prevent the user from inputting newlines (this kicks in on paste, etc.)
		return value.replace( /\r?\n/g, ' ' );
	}
} );
// Prevent the user from inputting newlines from keyboard
this.editSummaryInput.$input.on( 'keypress', function ( e ) {
	if ( e.which === OO.ui.Keys.ENTER ) {
		e.preventDefault();
	}
} );

Might be worth having a "word-wrapped single-line input text field" widget?

Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF set the point value for this task to 1.