(feature) Custom base font size for HTML messages
If SOGoMailComposeFontSize is set to zero, we keep the previous behaviour (no font-size added to the message HTML body).pull/189/merge
parent
e897bb0399
commit
256a64172e
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@
|
|||
New features
|
||||
- [web] show all/only this calendar
|
||||
- [web] convert a message to an appointment or a task (#1722)
|
||||
- [web] customizable base font size for HTML messages
|
||||
|
||||
Enhancements
|
||||
- [web] added Junk handling feature from v2
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
SOGoTrashFolderName = "Trash";
|
||||
SOGoJunkFolderName = "Junk";
|
||||
SOGoMailComposeMessageType = "html";
|
||||
SOGoMailComposeFontSize = 0;
|
||||
SOGoMailDisplayRemoteInlineImages = "never";
|
||||
|
||||
SOGoMailAutoSave = "5";
|
||||
|
|
|
@ -132,6 +132,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
|||
- (void) setMailComposeMessageType: (NSString *) newValue;
|
||||
- (NSString *) mailComposeMessageType;
|
||||
|
||||
- (void) setMailComposeFontSize: (NSString *) newValue;
|
||||
- (NSString *) mailComposeFontSize;
|
||||
|
||||
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue;
|
||||
- (NSString *) mailDisplayRemoteInlineImages;
|
||||
|
||||
|
|
|
@ -539,6 +539,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
|||
return [self stringForKey: @"SOGoMailComposeMessageType"];
|
||||
}
|
||||
|
||||
- (void) setMailComposeFontSize: (NSString *) newValue
|
||||
{
|
||||
[self setObject: newValue forKey: @"SOGoMailComposeFontSize"];
|
||||
}
|
||||
|
||||
- (NSString *) mailComposeFontSize
|
||||
{
|
||||
return [self stringForKey: @"SOGoMailComposeFontSize"];
|
||||
}
|
||||
|
||||
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue
|
||||
{
|
||||
[self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"];
|
||||
|
|
|
@ -629,9 +629,11 @@ static NSArray *infoKeys = nil;
|
|||
{
|
||||
NSDictionary *info;
|
||||
NSException *error;
|
||||
NSString *fontSize, *content;
|
||||
NGMimeType *mimeType;
|
||||
WORequest *request;
|
||||
SOGoDraftObject *co;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
error = nil;
|
||||
request = [context request];
|
||||
|
@ -649,7 +651,22 @@ static NSArray *infoKeys = nil;
|
|||
info = [self infoFromRequest];
|
||||
[co setHeaders: info];
|
||||
[co setIsHTML: isHTML];
|
||||
[co setText: (isHTML ? [NSString stringWithFormat: @"<html>%@</html>", text] : text)];;
|
||||
if (isHTML)
|
||||
{
|
||||
// Set a base font size if mail is HTML and user has set a default font-size
|
||||
ud = [[context activeUser] userDefaults];
|
||||
fontSize = [ud mailComposeFontSize];
|
||||
if ([fontSize intValue] > 0)
|
||||
content = [NSString stringWithFormat: @"<html><span style=\"font-size: %@px;\">%@</span></html>",
|
||||
fontSize, text];
|
||||
else
|
||||
content = [NSString stringWithFormat: @"<html>%@</html>", text];
|
||||
}
|
||||
else
|
||||
{
|
||||
content = text;
|
||||
}
|
||||
[co setText: content];
|
||||
error = [co storeInfo];
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,10 @@
|
|||
"Compose messages in" = "Compose messages in";
|
||||
"composemessagestype_html" = "HTML";
|
||||
"composemessagestype_text" = "Plain text";
|
||||
|
||||
/* Base font size for messages composed in HTML */
|
||||
"Default font size" = "Default font size";
|
||||
|
||||
"Display remote inline images" = "Display remote inline images";
|
||||
"displayremoteinlineimages_never" = "Never";
|
||||
"displayremoteinlineimages_always" = "Always";
|
||||
|
|
|
@ -174,6 +174,9 @@ static SoProduct *preferencesProduct = nil;
|
|||
if (![[defaults source] objectForKey: @"SOGoMailComposeMessageType"])
|
||||
[[defaults source] setObject: [defaults mailComposeMessageType] forKey: @"SOGoMailComposeMessageType"];
|
||||
|
||||
if (![[defaults source] objectForKey: @"SOGoMailComposeFontSize"])
|
||||
[[defaults source] setObject: [defaults mailComposeFontSize] forKey: @"SOGoMailComposeFontSize"];
|
||||
|
||||
if (![[defaults source] objectForKey: @"SOGoMailDisplayRemoteInlineImages"])
|
||||
[[defaults source] setObject: [defaults mailDisplayRemoteInlineImages] forKey: @"SOGoMailDisplayRemoteInlineImages"];
|
||||
|
||||
|
|
|
@ -1172,6 +1172,27 @@ static NSArray *reminderValues = nil;
|
|||
: [self _defaultEmailAddresses]);
|
||||
}
|
||||
|
||||
//
|
||||
// Used by templates
|
||||
//
|
||||
- (NSArray *) fontSizesList
|
||||
{
|
||||
static NSArray *fontSizes = nil;
|
||||
|
||||
if (!fontSizes)
|
||||
{
|
||||
fontSizes = [NSArray arrayWithObjects: @"8", @"9", @"10", @"11", @"12", @"13", @"14", @"16", @"18",
|
||||
@"20", @"22", @"24", @"26", @"28",
|
||||
@"36",
|
||||
@"48",
|
||||
@"72",
|
||||
nil];
|
||||
[fontSizes retain];
|
||||
}
|
||||
|
||||
return fontSizes;
|
||||
}
|
||||
|
||||
//
|
||||
// Used by templates
|
||||
//
|
||||
|
|
|
@ -511,19 +511,18 @@
|
|||
</md-checkbox>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div layout="row" layout-align="start center" flex="50" flex-xs="100">
|
||||
<md-checkbox
|
||||
class="md-align-top-left" ng-model="app.preferences.defaults.SOGoMailAddOutgoingAddresses"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0"
|
||||
label:arial-label="When sending mail, add unknown recipients to my">
|
||||
<var:string label:value="When sending mail, add unknown recipients to my"/>
|
||||
</md-checkbox>
|
||||
|
||||
<md-input-container>
|
||||
<label><var:string label:aria-label="Address Book"/></label>
|
||||
<md-input-container class="md-block md-flex">
|
||||
<label><var:string label:value="When sending mail, add unknown recipients to my"/></label>
|
||||
<md-select
|
||||
ng-disabled="app.preferences.defaults.SOGoMailAddOutgoingAddresses == 0"
|
||||
ng-disabled="app.preferences.defaults.SOGoMailAddOutgoingAddresses != 1"
|
||||
ng-model="app.preferences.defaults.SOGoSelectedAddressBook">
|
||||
<var:foreach list="addressBookList" item="item">
|
||||
<md-option var:value="item.id">
|
||||
|
@ -534,7 +533,7 @@
|
|||
</md-input-container>
|
||||
</div>
|
||||
|
||||
<md-input-container class="md-block">
|
||||
<md-input-container class="md-block" flex="50" flex-xs="100">
|
||||
<label><var:string label:value="Forward messages"/></label>
|
||||
<md-select ng-model="app.preferences.defaults.SOGoMailMessageForwarding">
|
||||
<var:foreach list="messageForwardingList" item="item">
|
||||
|
@ -569,18 +568,42 @@
|
|||
</md-input-container>
|
||||
</div>
|
||||
|
||||
<md-input-container class="md-block">
|
||||
<label><var:string label:value="Compose messages in"/></label>
|
||||
<md-select ng-model="app.preferences.defaults.SOGoMailComposeMessageType">
|
||||
<var:foreach list="composeMessagesType" item="item">
|
||||
<md-option var:value="item">
|
||||
<var:string value="itemComposeMessagesText"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
<div layout="row" layout-wrap="layout-wrap">
|
||||
<md-input-container class="md-block" flex="50">
|
||||
<label><var:string label:value="Compose messages in"/></label>
|
||||
<md-select ng-model="app.preferences.defaults.SOGoMailComposeMessageType">
|
||||
<var:foreach list="composeMessagesType" item="item">
|
||||
<md-option var:value="item">
|
||||
<var:string value="itemComposeMessagesText"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
|
||||
<md-input-container class="md-block">
|
||||
<div layout="row" flex="50"
|
||||
ng-show="app.preferences.defaults.SOGoMailComposeMessageType == 'html'">
|
||||
<md-checkbox
|
||||
ng-model="app.preferences.defaults.SOGoMailComposeFontSizeEnabled"
|
||||
label:aria-label="Default font size">
|
||||
</md-checkbox>
|
||||
<md-input-container class="md-block md-flex">
|
||||
<label><var:string label:value="Default font size"/></label>
|
||||
<md-select label:aria-label="Default font size"
|
||||
ng-disabled="!app.preferences.defaults.SOGoMailComposeFontSizeEnabled"
|
||||
ng-required="app.preferences.defaults.SOGoMailComposeFontSizeEnabled"
|
||||
ng-model="app.preferences.defaults.SOGoMailComposeFontSize">
|
||||
<var:foreach list="fontSizesList" item="item">
|
||||
<md-option var:value="item">
|
||||
<var:string value="item"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
<div class="md-char-counter">px</div>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<md-input-container class="md-block" flex="50" flex-xs="100">
|
||||
<label><var:string label:value="Display remote inline images"/></label>
|
||||
<md-select ng-model="app.preferences.defaults.SOGoMailDisplayRemoteInlineImages">
|
||||
<var:foreach list="displayRemoteInlineImages" item="item">
|
||||
|
|
|
@ -26,6 +26,15 @@
|
|||
// Mail editor autosave is a number of minutes or 0 if disabled
|
||||
data.SOGoMailAutoSave = parseInt(data.SOGoMailAutoSave) || 0;
|
||||
|
||||
// Specify a base font size for HTML messages when SOGoMailComposeFontSize is not zero
|
||||
data.SOGoMailComposeFontSizeEnabled = parseInt(data.SOGoMailComposeFontSize) > 0;
|
||||
|
||||
if (window.CKEDITOR && data.SOGoMailComposeFontSize) {
|
||||
// HTML editor is enabled; set user's preferred font size
|
||||
window.CKEDITOR.config.fontSize_defaultLabel = data.SOGoMailComposeFontSize;
|
||||
window.CKEDITOR.addCss('.cke_editable { font-size: ' + data.SOGoMailComposeFontSize + 'px; }');
|
||||
}
|
||||
|
||||
// We convert our list of autoReplyEmailAddresses/forwardAddress into a string.
|
||||
// We also convert our date objects into real date, otherwise we'll have strings
|
||||
// or undefined values and the md-datepicker does NOT like this.
|
||||
|
@ -201,6 +210,9 @@
|
|||
|
||||
preferences.defaults.SOGoMailLabelsColors = labels;
|
||||
|
||||
if (!preferences.defaults.SOGoMailComposeFontSizeEnabled)
|
||||
preferences.defaults.SOGoMailComposeFontSize = 0;
|
||||
|
||||
if (preferences.defaults.Vacation) {
|
||||
if (preferences.defaults.Vacation.endDateEnabled)
|
||||
preferences.defaults.Vacation.endDate = preferences.defaults.Vacation.endDate.getTime()/1000;
|
||||
|
|
|
@ -23,17 +23,6 @@ CKEDITOR.editorConfig = function( config ) {
|
|||
config.tabSpaces = 4;
|
||||
config.allowedContent = true; // don't filter tags
|
||||
|
||||
// The list of fonts size to be displayed in the Font Size combo in the toolbar.
|
||||
config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';
|
||||
|
||||
// Explicitly show the default site font size to the end user (as defined in contents.css)
|
||||
config.fontSize_defaultLabel = '13px';
|
||||
|
||||
// The CSS file(s) to be used to apply style to editor content.
|
||||
// For example, the following ck.css could overwrite the font-size of .cke_editable
|
||||
//config.contentsCss = ['/SOGo.woa/WebServerResources/js/vendor/ckeditor/contents.css', // default CSS
|
||||
// '/css/ck.css']; // custom CSS
|
||||
|
||||
// Disables the built-in words spell checker if browser provides one. Defaults to true.
|
||||
// http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-disableNativeSpellChecker
|
||||
//config.disableNativeSpellChecker = false;
|
||||
|
|
Loading…
Reference in New Issue