Merge pull request #3734 from kinglozzer/pulls/3632-mailto-subject

NEW: Subject line for email links in HtmlEditorField
This commit is contained in:
Daniel Hensby 2014-12-15 22:48:36 +00:00
commit 89feb174ad
2 changed files with 8 additions and 1 deletions

View File

@ -253,6 +253,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
EmailField::create('email', _t('HtmlEditorField.EMAIL', 'Email address')), EmailField::create('email', _t('HtmlEditorField.EMAIL', 'Email address')),
TreeDropdownField::create('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), TreeDropdownField::create('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true),
TextField::create('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')), TextField::create('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')),
TextField::create('Subject', _t('HtmlEditorField.SUBJECT', 'Email subject')),
TextField::create('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')), TextField::create('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')),
CheckboxField::create('TargetBlank', CheckboxField::create('TargetBlank',
_t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')), _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')),

View File

@ -572,7 +572,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this.find('.field[id$="Anchor_Holder"]').show(); 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(); this.find('.field[id$="TargetBlank_Holder"]').show();
} }
@ -587,6 +589,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
getLinkAttributes: function() { getLinkAttributes: function() {
var href, var href,
target = null, target = null,
subject = this.find(':input[name=Subject]').val(),
anchor = this.find(':input[name=Anchor]').val(); anchor = this.find(':input[name=Anchor]').val();
// Determine target // Determine target
@ -616,6 +619,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
case 'email': case 'email':
href = 'mailto:' + this.find(':input[name=email]').val(); href = 'mailto:' + this.find(':input[name=email]').val();
if(subject) {
href += '?subject=' + encodeURIComponent(subject);
}
target = null; target = null;
break; break;