Skip to content
This repository
Browse code

BUGFIX Show/hide correct fields when inserting a link in HtmlEditorField

  • Loading branch information...
commit 6f89fe0703904126953a7e31a8cbbb5d9f5a3779 1 parent 266b0e8
Sean Harvey authored

Showing 1 changed file with 11 additions and 5 deletions. Show diff stats Hide diff stats

  1. 16  javascript/HtmlEditorField.js
16  javascript/HtmlEditorField.js
@@ -340,7 +340,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
340 340
 			redraw: function(setDefaults) {
341 341
 				this._super();
342 342
 
343  
-				var linkType = this.find(':input[name=LinkType]:checked').val(), list =  ['internal', 'external', 'file', 'email'], i, item;
  343
+				var linkType = this.find(':input[name=LinkType]:checked').val(), list = ['internal', 'external', 'file', 'email'];
344 344
 
345 345
 				// If we haven't selected an existing link, then just make sure we default to "internal" for the link type.
346 346
 				if(!linkType) {
@@ -351,11 +351,17 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
351 351
 				this.addAnchorSelector();
352 352
 
353 353
 				// Toggle field visibility and state based on type selection
354  
-				for(i=0;item==list[i];i++) jQuery(this.find('.field#' + item)).toggle(item == linkType);
355  
-				jQuery(this.find('.field#Anchor')).toggle(linkType == 'internal' || linkType == 'anchor');
356  
-				jQuery(this.find('.field#AnchorSelector')).toggle(linkType=='anchor');
357  
-				jQuery(this.find('.field#AnchorRefresh')).toggle(linkType=='anchor');
  354
+				this.find('.field').hide();
  355
+				this.find('.field#LinkType').show();
  356
+				this.find('.field#' + linkType).show();
  357
+				if(linkType == 'internal' || linkType == 'anchor') this.find('.field#Anchor').show();
  358
+				if(linkType == 'anchor') {
  359
+					this.find('.field#AnchorSelector').show();
  360
+					this.find('.field#AnchorRefresh').show();
  361
+				}
  362
+
358 363
 				this.find(':input[name=TargetBlank]').attr('disabled', (linkType == 'email'));
  364
+
359 365
 				if(typeof setDefaults == 'undefined' || setDefaults) {
360 366
 					this.find(':input[name=TargetBlank]').attr('checked', (linkType == 'file'));
361 367
 				}

0 notes on commit 6f89fe0

Please sign in to comment.
Something went wrong with that request. Please try again.