From 16cca5b1a27712b3ddb0b0515a58392d6b8de073 Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Mon, 12 Jan 2015 15:29:38 -0800 Subject: [PATCH] Trim aliases on save Make sure that aliases get trimmed and are not getting extra spaces when saving a parameter. NOTE: To prevent dirty diffs, only parameters that are 'touched' (viewed or edited directly in the editor) will be trimmed. The editor will keep all other "wrong" values that have trailing or preceding whitespaces as-is. Bug: T85330 Change-Id: I64ecb88a7d736fa36b5e6debf2e94b0d37152020 --- modules/ext.templateDataGenerator.data.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ext.templateDataGenerator.data.js b/modules/ext.templateDataGenerator.data.js index fe9367d2..0ebfe7bd 100644 --- a/modules/ext.templateDataGenerator.data.js +++ b/modules/ext.templateDataGenerator.data.js @@ -136,7 +136,7 @@ }, aliases: { type: 'array', - delimiter: ',' + delimiter: mw.msg( 'comma-separator' ) }, label: { type: 'string', @@ -210,7 +210,7 @@ */ TemplateDataModel.static.splitAndTrimArray = function ( str, delim ) { var arr = []; - delim = delim || ','; + delim = delim || mw.msg( 'comma-separator' ); $.each( str.split( delim ), function () { var trimmed = $.trim( this ); @@ -231,9 +231,9 @@ TemplateDataModel.static.arrayUnionWithoutEmpty = function () { var result = OO.simpleArrayUnion.apply( this, arguments ); - // Filter empty strings + // Trim and filter empty strings return result.filter( function ( i ) { - return i; + return $.trim( i ); } ); };