Skip to content
This repository
Browse code

BUGFIX Partially reverting 28e43bd which broke media insertion

  • Loading branch information...
commit 0235a8c0c76468d21196ab64b8a39b77c7265be8 1 parent 23a3872
Sean Harvey authored May 28, 2012
9  forms/HtmlEditorField.php
@@ -159,8 +159,7 @@ public function saveInto(DataObjectInterface $record) {
159 159
 				if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) {
160 160
 					//Make sure that the resized image actually returns an image:
161 161
 					$resized=$image->ResizedImage($width, $height);
162  
-					if($resized)
163  
-						$img->setAttribute('src', $resized->getRelativePath());
  162
+					if($resized) $img->setAttribute('src', $resized->getRelativePath());
164 163
 				}
165 164
 			}
166 165
 			
@@ -429,17 +428,17 @@ function MediaForm() {
429 428
 			$editComposite = new CompositeField(
430 429
 				new LiteralField('contentEdit', '<div class="content-edit ss-uploadfield-files files"></div>')
431 430
 
432  
-			)			
  431
+			)
433 432
 		);
434 433
 
435  
-		$allFields -> addExtraClass('ss-insert-media');
  434
+		$allFields->addExtraClass('ss-insert-media');
436 435
 
437 436
 		$headings = new CompositeField(
438 437
 			new LiteralField(
439 438
 				'Heading',
440 439
 				sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.INSERTMEDIA', 'Insert Media')).
441 440
 				sprintf('<h3 class="htmleditorfield-mediaform-heading update">%s</h3>', _t('HtmlEditorField.UpdateMEDIA', 'Update Media'))
442  
-			)		
  441
+			)
443 442
 		);
444 443
 
445 444
 		$headings->addExtraClass('cms-content-header');
13  javascript/HtmlEditorField.js
@@ -676,7 +676,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
676 676
 				var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
677 677
 				this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show']();
678 678
 			},
679  
-			onsubmit: function() {				
  679
+			onsubmit: function() {
680 680
 				var self = this, ed = this.getEditor();
681 681
 
682 682
 				// HACK: See ondialogopen()
@@ -690,7 +690,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
690 690
 
691 691
 				return false;
692 692
 			},
693  
-			updateFromEditor: function() {			
  693
+			updateFromEditor: function() {
694 694
 				var self = this, ed = this.getEditor(), node = $(ed.getSelectedNode());
695 695
 				// TODO Depends on managed mime type
696 696
 				if(node.is('img')) {
@@ -714,7 +714,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
714 714
 				if(header) header[(hasItems) ? 'show' : 'hide']();
715 715
 
716 716
 				// Disable "insert" button if no files are selected
717  
-				 this.find('.Actions :submit')
  717
+				this.find('.Actions :submit')
718 718
 					.button(hasItems ? 'enable' : 'disable')
719 719
 					.toggleClass('ui-state-disabled', !hasItems); 
720 720
 					
@@ -728,7 +728,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
728 728
 				this.find('.htmleditorfield-mediaform-heading.update')[updateExisting ? 'show' : 'hide']();
729 729
 				this.find('.Actions .media-update')[updateExisting ? 'show' : 'hide']();
730 730
 			},
731  
-			resetFields: function() {				
  731
+			resetFields: function() {
732 732
 				var ed = this.getEditor(), node = $(ed.getSelectedNode());
733 733
 
734 734
 				// HACK: See ondialogopen()
@@ -849,8 +849,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
849 849
 			 * Insert updated HTML content into the rich text editor
850 850
 			 */
851 851
 			insertHTML: function() {
852  
-				
853  
-				var ed = this.getEditor();
  852
+				var form = this.closest('form'), ed = form.getEditor();
854 853
 				
855 854
 				// Workaround for browsers losing focus, similar to tinyMCEPopup.restoreSelection
856 855
 				ed.moveToBookmark(window._ss_htmleditorfield_bookmark);
@@ -940,7 +939,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
940 939
 			 * Logic similar to TinyMCE 'advimage' plugin, insertAndClose() method.
941 940
 			 */
942 941
 			insertHTML: function() {
943  
-				var form = this.closest('.cms').find('.cms-container textarea.htmleditor'), ed = form.getEditor(), 
  942
+				var form = this.closest('form'), ed = form.getEditor(), 
944 943
 				node = $(ed.getSelectedNode()), captionNode = node.closest('.captionImage');
945 944
 
946 945
 				// Workaround for browsers losing focus, similar to tinyMCEPopup.restoreSelection.
5  templates/Includes/HtmlEditorField_viewfile.ss
... ...
@@ -1,5 +1,3 @@
1  
-
2  
-
3 1
 <div class="ss-uploadfield-item $appCategory ss-htmleditorfield-file template-upload" data-id="$File.ID" data-url="$URL">
4 2
 	<div class="ss-uploadfield-item-preview">
5 3
 		<span>$Preview.SetRatioSize(30, 40)</span>
@@ -37,6 +35,3 @@
37 35
 	</div>
38 36
 </div>
39 37
 
40  
-
41  
-
42  
-

0 notes on commit 0235a8c

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