diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index e5fdff072..409f68396 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -594,13 +594,13 @@ class HtmlEditorField_Toolbar extends RequestHandler { $urlField->dontEscape = true; if($file->Type == 'photo') { - $filePreview->FieldList()->insertBefore(new TextField( + $fields->insertBefore(new TextField( 'AltText', _t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'), $file->Title, 80 ), 'CaptionText'); - $filePreview->FieldList()->insertBefore(new TextField( + $fields->insertBefore(new TextField( 'Title', _t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image') ), 'CaptionText'); diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index fed30bfc9..d0b34b30e 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -1226,7 +1226,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; 'src' : this.find('.thumbnail-preview').attr('src'), 'width' : width ? parseInt(width, 10) : null, 'height' : height ? parseInt(height, 10) : null, - 'class' : this.find(':input[name=CSSClass]').val() + 'class' : this.find(':input[name=CSSClass]').val(), + 'alt' : this.find(':input[name=AltText]').val(), + 'title' : this.find(':input[name=Title]').val() }; }, getExtraData: function() { @@ -1260,6 +1262,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; return $('
').append(el).html(); // Little hack to get outerHTML string }, updateFromNode: function(node) { + this.find(':input[name=AltText]').val(node.attr('alt')); + this.find(':input[name=Title]').val(node.attr('title')); this.find(':input[name=Width]').val(node.width()); this.find(':input[name=Height]').val(node.height()); this.find(':input[name=Title]').val(node.attr('title'));