diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index e1f9569d2..b2f124fdb 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -159,8 +159,7 @@ class HtmlEditorField extends TextareaField { if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) { //Make sure that the resized image actually returns an image: $resized=$image->ResizedImage($width, $height); - if($resized) - $img->setAttribute('src', $resized->getRelativePath()); + if($resized) $img->setAttribute('src', $resized->getRelativePath()); } } @@ -429,17 +428,17 @@ class HtmlEditorField_Toolbar extends RequestHandler { $editComposite = new CompositeField( new LiteralField('contentEdit', '
') - ) + ) ); - $allFields -> addExtraClass('ss-insert-media'); + $allFields->addExtraClass('ss-insert-media'); $headings = new CompositeField( new LiteralField( 'Heading', sprintf('

%s

', _t('HtmlEditorField.INSERTMEDIA', 'Insert Media')). sprintf('

%s

', _t('HtmlEditorField.UpdateMEDIA', 'Update Media')) - ) + ) ); $headings->addExtraClass('cms-content-header'); diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index 30dd72f46..0b7be1eac 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -676,7 +676,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length); this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show'](); }, - onsubmit: function() { + onsubmit: function() { var self = this, ed = this.getEditor(); // HACK: See ondialogopen() @@ -690,7 +690,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; return false; }, - updateFromEditor: function() { + updateFromEditor: function() { var self = this, ed = this.getEditor(), node = $(ed.getSelectedNode()); // TODO Depends on managed mime type if(node.is('img')) { @@ -714,7 +714,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; if(header) header[(hasItems) ? 'show' : 'hide'](); // Disable "insert" button if no files are selected - this.find('.Actions :submit') + this.find('.Actions :submit') .button(hasItems ? 'enable' : 'disable') .toggleClass('ui-state-disabled', !hasItems); @@ -728,7 +728,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; this.find('.htmleditorfield-mediaform-heading.update')[updateExisting ? 'show' : 'hide'](); this.find('.Actions .media-update')[updateExisting ? 'show' : 'hide'](); }, - resetFields: function() { + resetFields: function() { var ed = this.getEditor(), node = $(ed.getSelectedNode()); // HACK: See ondialogopen() @@ -849,8 +849,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; * Insert updated HTML content into the rich text editor */ insertHTML: function() { - - var ed = this.getEditor(); + var form = this.closest('form'), ed = form.getEditor(); // Workaround for browsers losing focus, similar to tinyMCEPopup.restoreSelection ed.moveToBookmark(window._ss_htmleditorfield_bookmark); @@ -940,7 +939,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; * Logic similar to TinyMCE 'advimage' plugin, insertAndClose() method. */ insertHTML: function() { - var form = this.closest('.cms').find('.cms-container textarea.htmleditor'), ed = form.getEditor(), + var form = this.closest('form'), ed = form.getEditor(), node = $(ed.getSelectedNode()), captionNode = node.closest('.captionImage'); // Workaround for browsers losing focus, similar to tinyMCEPopup.restoreSelection. diff --git a/templates/Includes/HtmlEditorField_viewfile.ss b/templates/Includes/HtmlEditorField_viewfile.ss index 66f018ab5..7f3934e80 100644 --- a/templates/Includes/HtmlEditorField_viewfile.ss +++ b/templates/Includes/HtmlEditorField_viewfile.ss @@ -1,5 +1,3 @@ - -
$Preview.SetRatioSize(30, 40) @@ -37,6 +35,3 @@
- - -