Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 42 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 43 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 312 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 313 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 312 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 313 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -211,6 +211,7 @@ |
212 | 212 | var $templateText = $templateDiv.children( '.wikiEditor-template-text' ); |
213 | 213 | var templateModel = $templateText.data( 'model' ); |
214 | 214 | $( this ).find( '.wikiEditor-template-dialog-field-wrapper textarea' ).each( function() { |
| 215 | + // Update the value, ensuring we strip any illegal multiple line breaks |
215 | 216 | templateModel.setValue( $( this ).data( 'name' ), $( this ).val().replace( /\n+/g, '/n' ) ); |
216 | 217 | }); |
217 | 218 | //keep text consistent |
— | — | @@ -270,7 +271,7 @@ |
271 | 272 | var $this = $( this ); |
272 | 273 | setTimeout( function() { |
273 | 274 | var expanded = $this.data( 'expanded' ); |
274 | | - if ( $this.val().match( /\n/ ) || $this.val().length > 24 ) { |
| 275 | + if ( $this.val().indexOf( '\n' ) != -1 || $this.val().length > 24 ) { |
275 | 276 | if ( !expanded ) { |
276 | 277 | $this.animate( { 'height': '4.5em' }, 'fast' ); |
277 | 278 | $this.data( 'expanded', true ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -9324,6 +9324,7 @@ |
9325 | 9325 | var $templateText = $templateDiv.children( '.wikiEditor-template-text' ); |
9326 | 9326 | var templateModel = $templateText.data( 'model' ); |
9327 | 9327 | $( this ).find( '.wikiEditor-template-dialog-field-wrapper textarea' ).each( function() { |
| 9328 | + // Update the value, ensuring we strip any illegal multiple line breaks |
9328 | 9329 | templateModel.setValue( $( this ).data( 'name' ), $( this ).val().replace( /\n+/g, '/n' ) ); |
9329 | 9330 | }); |
9330 | 9331 | //keep text consistent |
— | — | @@ -9383,7 +9384,7 @@ |
9384 | 9385 | var $this = $( this ); |
9385 | 9386 | setTimeout( function() { |
9386 | 9387 | var expanded = $this.data( 'expanded' ); |
9387 | | - if ( $this.val().match( /\n/ ) || $this.val().length > 24 ) { |
| 9388 | + if ( $this.val().indexOf( '\n' ) != -1 || $this.val().length > 24 ) { |
9388 | 9389 | if ( !expanded ) { |
9389 | 9390 | $this.animate( { 'height': '4.5em' }, 'fast' ); |
9390 | 9391 | $this.data( 'expanded', true ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -646,7 +646,7 @@ |
647 | 647 | <div class="wikiEditor-template-dialog-fields" />\ |
648 | 648 | </fieldset>',init:function(){$(this).find('[rel]').each(function(){$(this).text(mw.usability.getMsg($(this).attr('rel')));});},dialog:{width:600,height:400,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-template-editor-dialog-submit':function(){var $templateDiv=$(this).data('templateDiv');context.fn.highlightLine($templateDiv);var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');$(this).find('.wikiEditor-template-dialog-field-wrapper textarea').each(function(){templateModel.setValue($(this).data('name'),$(this).val().replace(/\n+/g,'/n'));});$.wikiEditor.modules.templateEditor.fn.updateModel($templateText,templateModel);$(this).dialog('close');}},open:function(){var $templateDiv=$(this).data('templateDiv');var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');if($templateText.html()!=$templateText.data('oldHTML')){templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);} |
649 | 649 | var params=templateModel.getAllInitialParams();var $fields=$(this).find('.wikiEditor-template-dialog-fields');var $rows=$fields.find('.wikiEditor-template-dialog-field-wrapper');for(var paramIndex in params){var param=params[paramIndex];if(typeof param.name=='undefined'){continue;} |
650 | | -var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('textarea').data('name',param.name).val(paramVal).change();$rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<textarea />').data('name',param.name).val(paramVal).data('expanded',false).bind('cut paste keypress click change',function(e){if(e.keyCode=='9')return true;var $this=$(this);setTimeout(function(){var expanded=$this.data('expanded');if($this.val().match(/\n/)||$this.val().length>24){if(!expanded){$this.animate({'height':'4.5em'},'fast');$this.data('expanded',true);}}else{if(expanded){$this.animate({'height':'1.5em'},'fast');$this.data('expanded',false);}}},0);}).appendTo($paramRow);$paramRow.append('<div style="clear:both"></div>').appendTo($fields);}} |
| 650 | +var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('textarea').data('name',param.name).val(paramVal).change();$rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<textarea />').data('name',param.name).val(paramVal).data('expanded',false).bind('cut paste keypress click change',function(e){if(e.keyCode=='9')return true;var $this=$(this);setTimeout(function(){var expanded=$this.data('expanded');if($this.val().indexOf('\n')!=-1||$this.val().length>24){if(!expanded){$this.animate({'height':'4.5em'},'fast');$this.data('expanded',true);}}else{if(expanded){$this.animate({'height':'1.5em'},'fast');$this.data('expanded',false);}}},0);}).appendTo($paramRow);$paramRow.append('<div style="clear:both"></div>').appendTo($fields);}} |
651 | 651 | $rows.remove();$fields.find('label').autoEllipsis();$(this).parent('.ui-dialog').find('.ui-dialog-titlebar-close').removeClass('ui-state-focus');}}};function createDialog($templateDiv){context.$textarea.wikiEditor('addDialog',{'templateEditor':dialog});$('#'+dialog.id).data('templateDiv',$templateDiv).dialog('open');}},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},updateModel:function($templateText,model){var context=$templateText.data('marker').context;var text;if(typeof model=='undefined'){text=context.fn.htmlToText($templateText.html());}else{text=model.getText();} |
652 | 652 | $templateText.text(text);$templateText.html($templateText.html().replace(/\n/g,'<br />'));$templateText.data('oldHTML',$templateText.html());if(typeof model=='undefined'){model=new $.wikiEditor.modules.templateEditor.fn.model(text);$templateText.data('model',model);} |
653 | 653 | return model;},getTemplateInfo:function(templateName){var templateInfo='';return $(templateInfo);},model:function(wikitext){var collapsible=true;function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;} |