Handle missing pipes in Gallery syntax, and remove them when caption is empty

Bug: T146190
Change-Id: I703bcdf68b9631a47d839baf3abb42ff98b36bf2
This commit is contained in:
Ed Sanders 2016-11-28 17:36:29 +00:00
parent f2c444c1bd
commit 240ec23113

View file

@ -307,7 +307,7 @@ ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
imageTitles.push( titleText );
dialog.initialImageData.push( {
title: titleText,
caption: matches[ 3 ]
caption: matches[ 3 ] || ''
} );
}
}
@ -649,7 +649,7 @@ ve.ui.MWGalleryDialog.prototype.updateMwData = function ( mwData ) {
// Get titles and captions from gallery group
this.highlightedItem.setCaption( this.highlightedCaptionInput.getValue() );
for ( i = 0, ilen = items.length; i < ilen; i++ ) {
extsrc += '\n' + items[ i ].imageTitle + '|' + items[ i ].caption;
extsrc += '\n' + items[ i ].imageTitle + ( items[ i ].caption ? '|' + items[ i ].caption : '' );
}
// Get data from options card