Page MenuHomePhabricator

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


Some captions can be quite long:

Event Timeline

Esanders created this task.Jul 5 2016, 7:52 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 5 2016, 7:52 PM

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

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

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

@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?

Esanders added a comment.EditedJul 6 2016, 9:38 PM

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 ) {
} );

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

Jdforrester-WMF closed this task as Resolved.Jul 8 2016, 7:03 PM
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF set the point value for this task to 1.