BUGFIX Partially reverting 28e43bdc which broke media insertion

This commit is contained in:
Sean Harvey 2012-05-28 22:27:20 +12:00
parent 23a3872e34
commit 0235a8c0c7
3 changed files with 10 additions and 17 deletions

View File

@ -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', '<div class="content-edit ss-uploadfield-files files"></div>')
)
)
);
$allFields -> addExtraClass('ss-insert-media');
$allFields->addExtraClass('ss-insert-media');
$headings = new CompositeField(
new LiteralField(
'Heading',
sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.INSERTMEDIA', 'Insert Media')).
sprintf('<h3 class="htmleditorfield-mediaform-heading update">%s</h3>', _t('HtmlEditorField.UpdateMEDIA', 'Update Media'))
)
)
);
$headings->addExtraClass('cms-content-header');

View File

@ -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.

View File

@ -1,5 +1,3 @@
<div class="ss-uploadfield-item $appCategory ss-htmleditorfield-file template-upload" data-id="$File.ID" data-url="$URL">
<div class="ss-uploadfield-item-preview">
<span>$Preview.SetRatioSize(30, 40)</span>
@ -37,6 +35,3 @@
</div>
</div>