mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2731 from chillu/pulls/2723-embed-images-alt
"alt" and "title" attrs for images from URLs (fixes #2723)
This commit is contained in:
commit
5f86a69fdf
@ -594,13 +594,13 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$urlField->dontEscape = true;
|
$urlField->dontEscape = true;
|
||||||
|
|
||||||
if($file->Type == 'photo') {
|
if($file->Type == 'photo') {
|
||||||
$filePreview->FieldList()->insertBefore(new TextField(
|
$fields->insertBefore(new TextField(
|
||||||
'AltText',
|
'AltText',
|
||||||
_t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'),
|
_t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'),
|
||||||
$file->Title,
|
$file->Title,
|
||||||
80
|
80
|
||||||
), 'CaptionText');
|
), 'CaptionText');
|
||||||
$filePreview->FieldList()->insertBefore(new TextField(
|
$fields->insertBefore(new TextField(
|
||||||
'Title',
|
'Title',
|
||||||
_t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image')
|
_t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image')
|
||||||
), 'CaptionText');
|
), 'CaptionText');
|
||||||
|
@ -1226,7 +1226,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
'src' : this.find('.thumbnail-preview').attr('src'),
|
'src' : this.find('.thumbnail-preview').attr('src'),
|
||||||
'width' : width ? parseInt(width, 10) : null,
|
'width' : width ? parseInt(width, 10) : null,
|
||||||
'height' : height ? parseInt(height, 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() {
|
getExtraData: function() {
|
||||||
@ -1260,6 +1262,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
return $('<div />').append(el).html(); // Little hack to get outerHTML string
|
return $('<div />').append(el).html(); // Little hack to get outerHTML string
|
||||||
},
|
},
|
||||||
updateFromNode: function(node) {
|
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=Width]').val(node.width());
|
||||||
this.find(':input[name=Height]').val(node.height());
|
this.find(':input[name=Height]').val(node.height());
|
||||||
this.find(':input[name=Title]').val(node.attr('title'));
|
this.find(':input[name=Title]').val(node.attr('title'));
|
||||||
|
Loading…
Reference in New Issue
Block a user