mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-05 12:59:47 +01:00
* Mail: explicitly apply default font and -size before sending mail
This commit is contained in:
parent
0586400bda
commit
61b09363af
@ -351,6 +351,23 @@ var et2_htmlarea = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return this.options.readonly ? this.value : this.htmlNode.val();
|
return this.options.readonly ? this.value : this.htmlNode.val();
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Apply default font and -size
|
||||||
|
*/
|
||||||
|
et2_htmlarea.prototype.applyDefaultFont = function () {
|
||||||
|
var edit_area = this.editor.editorContainer.querySelector('iframe').contentDocument;
|
||||||
|
var font_family = egw.preference('rte_font', 'common') || 'arial, helvetica, sans-serif';
|
||||||
|
edit_area.querySelectorAll('h1:not([style*="font-family"]),h2:not([style*="font-family"]),h3:not([style*="font-family"]),h4:not([style*="font-family"]),h5:not([style*="font-family"]),h6:not([style*="font-family"]),' +
|
||||||
|
'div:not([style*="font-family"]),li:not([style*="font-family"]),p:not([style*="font-family"]),blockquote:not([style*="font-family"]),' +
|
||||||
|
'td:not([style*="font-family"]),th:not([style*="font-family"]').forEach(function (elem) {
|
||||||
|
elem.style.fontFamily = font_family;
|
||||||
|
});
|
||||||
|
var font_size = (egw.preference('rte_font_size', 'common') || '10') + (egw.preference('rte_font_unit', 'common') || 'pt');
|
||||||
|
edit_area.querySelectorAll('div:not([style*="font-size"]),li:not([style*="font-size"]),p:not([style*="font-size"]),blockquote:not([style*="font-size"]),' +
|
||||||
|
'td:not([style*="font-size"]),th:not([style*="font-size"])').forEach(function (elem) {
|
||||||
|
elem.style.fontSize = font_size;
|
||||||
|
});
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Resize htmlNode tag according to window size
|
* Resize htmlNode tag according to window size
|
||||||
* @param {type} _height excess height which comes from window resize
|
* @param {type} _height excess height which comes from window resize
|
||||||
|
@ -522,6 +522,27 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
|
|||||||
return this.options.readonly ? this.value : this.htmlNode.val();
|
return this.options.readonly ? this.value : this.htmlNode.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply default font and -size
|
||||||
|
*/
|
||||||
|
applyDefaultFont()
|
||||||
|
{
|
||||||
|
const edit_area = this.editor.editorContainer.querySelector('iframe').contentDocument;
|
||||||
|
const font_family = egw.preference('rte_font', 'common') || 'arial, helvetica, sans-serif';
|
||||||
|
edit_area.querySelectorAll('h1:not([style*="font-family"]),h2:not([style*="font-family"]),h3:not([style*="font-family"]),h4:not([style*="font-family"]),h5:not([style*="font-family"]),h6:not([style*="font-family"]),' +
|
||||||
|
'div:not([style*="font-family"]),li:not([style*="font-family"]),p:not([style*="font-family"]),blockquote:not([style*="font-family"]),' +
|
||||||
|
'td:not([style*="font-family"]),th:not([style*="font-family"]').forEach((elem) =>
|
||||||
|
{
|
||||||
|
elem.style.fontFamily = font_family;
|
||||||
|
});
|
||||||
|
const font_size = (<string>egw.preference('rte_font_size', 'common') || '10')+(egw.preference('rte_font_unit', 'common') || 'pt');
|
||||||
|
edit_area.querySelectorAll('div:not([style*="font-size"]),li:not([style*="font-size"]),p:not([style*="font-size"]),blockquote:not([style*="font-size"]),' +
|
||||||
|
'td:not([style*="font-size"]),th:not([style*="font-size"])').forEach((elem) =>
|
||||||
|
{
|
||||||
|
elem.style.fontSize = font_size;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resize htmlNode tag according to window size
|
* Resize htmlNode tag according to window size
|
||||||
* @param {type} _height excess height which comes from window resize
|
* @param {type} _height excess height which comes from window resize
|
||||||
|
@ -2536,8 +2536,7 @@ class mail_compose
|
|||||||
switch ($_formData['mimeType'])
|
switch ($_formData['mimeType'])
|
||||||
{
|
{
|
||||||
case 'html':
|
case 'html':
|
||||||
$body = "<style>\n".preg_replace('#/\*.*?\*/\s*#sm', '', Etemplate\Widget\HtmlArea::contentCss()).
|
$body = $_formData['body'];
|
||||||
"</style>\n".$_formData['body'];
|
|
||||||
|
|
||||||
if (!empty($attachment_links))
|
if (!empty($attachment_links))
|
||||||
{
|
{
|
||||||
|
@ -5631,6 +5631,10 @@ app.classes.mail = AppJS.extend(
|
|||||||
{
|
{
|
||||||
this.compose_submitAction(false);
|
this.compose_submitAction(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply default font and -size before submitting to server for sending
|
||||||
|
this.et2?.getWidgetById('mail_htmltext')?.applyDefaultFont();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user