diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php
index 8fe3d1ffd..435f92621 100644
--- a/forms/HtmlEditorField.php
+++ b/forms/HtmlEditorField.php
@@ -253,6 +253,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
EmailField::create('email', _t('HtmlEditorField.EMAIL', 'Email address')),
TreeDropdownField::create('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true),
TextField::create('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')),
+ TextField::create('Subject', _t('HtmlEditorField.SUBJECT', 'Email subject')),
TextField::create('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')),
CheckboxField::create('TargetBlank',
_t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')),
diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js
index 834e333c9..9697381dd 100644
--- a/javascript/HtmlEditorField.js
+++ b/javascript/HtmlEditorField.js
@@ -572,7 +572,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this.find('.field[id$="Anchor_Holder"]').show();
}
- if(linkType !== 'email') {
+ if(linkType == 'email') {
+ this.find('.field[id$="Subject_Holder"]').show();
+ } else {
this.find('.field[id$="TargetBlank_Holder"]').show();
}
@@ -587,6 +589,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
getLinkAttributes: function() {
var href,
target = null,
+ subject = this.find(':input[name=Subject]').val(),
anchor = this.find(':input[name=Anchor]').val();
// Determine target
@@ -616,6 +619,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
case 'email':
href = 'mailto:' + this.find(':input[name=email]').val();
+ if(subject) {
+ href += '?subject=' + encodeURIComponent(subject);
+ }
target = null;
break;