diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-09-21 11:24:16 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-09-21 11:24:16 +0200 |
commit | f7b2bfba092213af2f7101b18b96e957cbe0b217 (patch) | |
tree | 294af8a00516d41fe4c0989795a9e5d2539c8395 /program | |
parent | a149d566fca224e503b7676337486ec2670e6cca (diff) |
Bring back possibility to unset default font family and font size
Fix style attribute quoting when font-family contains double quotes
SOme code improvements
Diffstat (limited to 'program')
-rw-r--r-- | program/js/editor.js | 10 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 16 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 5 |
4 files changed, 24 insertions, 11 deletions
diff --git a/program/js/editor.js b/program/js/editor.js index e1ef36835..6d7b9538a 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -74,14 +74,18 @@ function rcmail_editor_init(config) // react to real individual tinyMCE editor init function rcmail_editor_callback() { - var elem = rcube_find_object('_from'), + var css = {}, + elem = rcube_find_object('_from'), fe = rcmail.env.compose_focus_elem; if (rcmail.env.default_font) - $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-family', rcmail.env.default_font); + css['font-family'] = rcmail.env.default_font; if (rcmail.env.default_font_size) - $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-size', rcmail.env.default_font_size); + css['font-size'] = rcmail.env.default_font_size; + + if (css['font-family'] || css['font-size']) + $(tinyMCE.get(rcmail.env.composebody).getBody()).css(css); if (elem && elem.type == 'select-one') { rcmail.change_identity(elem); diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 30c9f79fb..b62f9bf5a 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -149,7 +149,9 @@ if ($font && !is_array($font)) { } // default font size for HTML editor -$OUTPUT->set_env('default_font_size', $RCMAIL->config->get('default_font_size')); +if ($font_size = $RCMAIL->config->get('default_font_size')) { + $OUTPUT->set_env('default_font_size', $font_size); +} // get reference message and set compose mode if ($msg_uid = $COMPOSE['param']['draft_uid']) { diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 3f4475e46..dee8d2136 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -473,13 +473,19 @@ $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); if ($isHtml) { - $font_family = rcube_fontdefs($RCMAIL->config->get('default_font', 'Arial')); - $font_size = $RCMAIL->config->get('default_font_size'); - $bstyle = ' style="font:' . $font_size . ' ' . $font_family . ';"'; + $bstyle = array(); + + if ($font_size = $RCMAIL->config->get('default_font_size')) { + $bstyle[] = 'font-size: ' . $font_size; + } + if ($font_family = $RCMAIL->config->get('default_font')) { + $bstyle[] = 'font-family: ' . rcmail::font_defs($font_family); + } // append doctype and html/body wrappers - $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' . - "\r\n<html><body$bstyle>\r\n" . $message_body; + $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' + . "\r\n<html><body" . (!empty($bstyle) ? " style='" . implode($bstyle, '; ') . "'" : '') . ">\r\n" + . $message_body; } if (!$savedraft) { diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 53c98eddf..f1170178d 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -839,7 +839,7 @@ function rcmail_user_prefs($current = null) ); } - if (!isset($no_override['default_font'])) { + if (!isset($no_override['default_font']) || !isset($no_override['default_font_size'])) { if (!$current) { continue 2; } @@ -848,7 +848,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_default_font_size'; $select_default_font_size = new html_select(array('name' => '_default_font_size', 'id' => $field_id)); - $fontsizes = array('8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); + $fontsizes = array('', '8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); foreach ($fontsizes as $size) { $select_default_font_size->add($size, $size); } @@ -856,6 +856,7 @@ function rcmail_user_prefs($current = null) // Default font $field_id = 'rcmfd_default_font'; $select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); + $select_default_font->add('', ''); $fonts = rcube_fontdefs(); foreach ($fonts as $fname => $font) { |