diff --git a/api/js/etemplate/et2_widget_htmlarea.js b/api/js/etemplate/et2_widget_htmlarea.js
index d0ef3858f0..9946adbdbe 100644
--- a/api/js/etemplate/et2_widget_htmlarea.js
+++ b/api/js/etemplate/et2_widget_htmlarea.js
@@ -268,9 +268,12 @@ var et2_htmlarea = /** @class */ (function (_super) {
var rte_menubar = egw.preference('rte_menubar', 'common');
var rte_toolbar = egw.preference('rte_toolbar', 'common');
// we need to have rte_toolbar values as an array
- if (rte_toolbar && typeof rte_toolbar == "object") {
+ if (rte_toolbar && typeof rte_toolbar == "object" && this.toolbar == '') {
rte_toolbar = Object.keys(rte_toolbar).map(function (key) { return rte_toolbar[key]; });
}
+ else if (this.toolbar != '') {
+ rte_toolbar = this.toolbar.split(',');
+ }
var settings = {
fontsize_formats: et2_htmlarea.FONT_SIZE_FORMATS[egw.preference('rte_font_unit', 'common')],
menubar: parseInt(rte_menubar) && this.menubar ? true : typeof rte_menubar != 'undefined' ? false : this.menubar
@@ -417,6 +420,12 @@ var et2_htmlarea = /** @class */ (function (_super) {
description: "Enables to control what child tag is allowed or not allowed of the present tag. For instance: +body[style], makes style tag allowed inside body",
type: "string",
default: "+body[style]"
+ },
+ toolbar: {
+ 'name': 'Toolbar',
+ 'description': 'Comma separated string of toolbar actions. It will only be considered if no Mode is restricted.',
+ 'default': '',
+ 'type': 'string'
}
};
/**
@@ -426,7 +435,7 @@ var et2_htmlarea = /** @class */ (function (_super) {
et2_htmlarea.TOOLBAR_LIST = ['undo', 'redo', 'formatselect', 'fontselect', 'fontsizeselect',
'bold', 'italic', 'strikethrough', 'forecolor', 'backcolor', 'link',
'alignleft', 'aligncenter', 'alignright', 'alignjustify', 'numlist',
- 'bullist', 'outdent', 'indent', 'ltr', 'rtl', 'removeformat', 'code', 'image', 'searchreplace'
+ 'bullist', 'outdent', 'indent', 'ltr', 'rtl', 'removeformat', 'code', 'image', 'searchreplace', 'fullscreen'
];
/**
* arranged toolbars as simple mode
@@ -447,8 +456,8 @@ var et2_htmlarea = /** @class */ (function (_super) {
* @constant
*/
et2_htmlarea.TOOLBAR_ADVANCED = "undo redo| formatselect | fontselect fontsizeselect | bold italic strikethrough forecolor backcolor | " +
- "link | alignleft aligncenter alignright alignjustify | numlist " +
- "bullist outdent indent ltr rtl | removeformat code| image | searchreplace | fullscreen";
+ "alignleft aligncenter alignright alignjustify | numlist " +
+ "bullist outdent indent ltr rtl | removeformat code| link image pastetext | searchreplace | fullscreen";
/**
* font size formats
* @constant
diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts
index 6b53718029..368858d11c 100644
--- a/api/js/etemplate/et2_widget_htmlarea.ts
+++ b/api/js/etemplate/et2_widget_htmlarea.ts
@@ -83,6 +83,12 @@ class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
description: "Enables to control what child tag is allowed or not allowed of the present tag. For instance: +body[style], makes style tag allowed inside body",
type: "string",
default: "+body[style]"
+ },
+ toolbar: {
+ 'name': 'Toolbar',
+ 'description': 'Comma separated string of toolbar actions. It will only be considered if no Mode is restricted.',
+ 'default': '',
+ 'type': 'string'
}
};
@@ -93,7 +99,7 @@ class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
public static readonly TOOLBAR_LIST : string[] = ['undo', 'redo', 'formatselect', 'fontselect', 'fontsizeselect',
'bold', 'italic', 'strikethrough', 'forecolor', 'backcolor', 'link',
'alignleft', 'aligncenter', 'alignright', 'alignjustify', 'numlist',
- 'bullist', 'outdent', 'indent', 'ltr', 'rtl', 'removeformat', 'code', 'image', 'searchreplace'
+ 'bullist', 'outdent', 'indent', 'ltr', 'rtl', 'removeformat', 'code', 'image', 'searchreplace', 'fullscreen'
];
/**
@@ -117,8 +123,8 @@ class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
* @constant
*/
public static readonly TOOLBAR_ADVANCED : string = "undo redo| formatselect | fontselect fontsizeselect | bold italic strikethrough forecolor backcolor | "+
- "link | alignleft aligncenter alignright alignjustify | numlist "+
- "bullist outdent indent ltr rtl | removeformat code| image | searchreplace | fullscreen";
+ "alignleft aligncenter alignright alignjustify | numlist "+
+ "bullist outdent indent ltr rtl | removeformat code| link image pastetext | searchreplace | fullscreen";
/**
* font size formats
@@ -146,6 +152,7 @@ class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
supportedWidgetClasses : any;
htmlNode : JQuery = null;
mode : string;
+ toolbar: string;
tinymce : any;
tinymce_container : HTMLElement;
file_picker_callback : Function;
@@ -409,10 +416,14 @@ class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
let rte_menubar = egw.preference('rte_menubar', 'common');
let rte_toolbar = egw.preference('rte_toolbar', 'common');
// we need to have rte_toolbar values as an array
- if (rte_toolbar && typeof rte_toolbar == "object")
+ if (rte_toolbar && typeof rte_toolbar == "object" && this.toolbar == '')
{
rte_toolbar = Object.keys(rte_toolbar).map(function(key){return rte_toolbar[key]});
}
+ else if(this.toolbar != '')
+ {
+ rte_toolbar = this.toolbar.split(',');
+ }
let settings = {
fontsize_formats: et2_htmlarea.FONT_SIZE_FORMATS[egw.preference('rte_font_unit', 'common')],
menubar: parseInt(rte_menubar) && this.menubar ? true : typeof rte_menubar != 'undefined' ? false : this.menubar
diff --git a/api/src/Etemplate/Widget/HtmlArea.php b/api/src/Etemplate/Widget/HtmlArea.php
index d8c0367e24..0cb260caa4 100644
--- a/api/src/Etemplate/Widget/HtmlArea.php
+++ b/api/src/Etemplate/Widget/HtmlArea.php
@@ -26,15 +26,24 @@ class HtmlArea extends Etemplate\Widget
* @var type array
*/
public static $font_options = array(
+ 'andale mono,times' => 'Andale Mono',
'arial, helvetica, sans-serif' => 'Arial',
+ 'arial black,avant garde' => 'Arial Black',
+ 'book antiqua,palatino' => 'Book Antiqua',
'Comic Sans MS, cursive' => 'Comic Sans MS',
'Courier New, Courier, monospace' => 'Courier New',
'Georgia, serif' => 'Georgia',
+ 'helvetica' => 'Helvetica',
+ 'impact,chicago' => 'Impact',
'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode',
+ 'symbol' => 'Symbol',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
+ 'terminal, "monaco' => 'Terminal',
'times new roman, times, serif' => 'Times New Roman',
'Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet MS',
- 'Verdana, Geneva, sans-serif' => 'Verdana'
+ 'Verdana, Geneva, sans-serif' => 'Verdana',
+ 'webdings' => 'Webdings',
+ 'wingdings,zapf dingbats' => 'Wingdings'
);
/**
@@ -69,6 +78,56 @@ class HtmlArea extends Etemplate\Widget
'px' => 'px: display pixels',
);
+ /**
+ * List of exisitng toolbar actions
+ * @var type array
+ */
+ public static $toolbar_list = [
+ 'undo', 'redo', 'bold', 'italic', 'strikethrough', 'forecolor', 'backcolor',
+ 'link', 'alignleft', 'aligncenter', 'alignright', 'alignjustify',
+ 'numlist', 'bullist', 'outdent', 'indent', 'ltr', 'rtl','pastetext',
+ 'removeformat', 'code', 'image', 'searchreplace','formatselect', 'fontselect', 'fontsizeselect', 'fullscreen'
+ ];
+
+ /**
+ * Default list of toolbar actions
+ * @var type array
+ */
+ public static $toolbar_default_list = [
+ 'undo', 'redo','formatselect', 'fontselect', 'fontsizeselect',
+ 'bold' ,'italic', 'removeformat', 'forecolor', 'backcolor', 'alignleft',
+ 'aligncenter', 'alignright', 'alignjustify', 'numlist', 'bullist', 'outdent',
+ 'indent', 'link', 'image', 'pastetext'
+ ];
+
+ /**
+ * Create an array of toolbar as sel options
+ *
+ * @return array
+ * [
+ * id => {string}
+ * label => {string}
+ * title => {string}
+ * icon => {string}
+ * app => {string}
+ * ]
+ */
+ public static function get_toolbar_as_selOptions ()
+ {
+ $toolbar_selOptions = array();
+ foreach (self::$toolbar_list as $toolbar)
+ {
+ $toolbar_selOptions[$toolbar] = array (
+ 'id' => $toolbar,
+ 'label' => lang($toolbar),
+ 'title' => lang($toolbar),
+ 'icon' => Api\Framework::getUrl($GLOBALS['egw_info']['server']['webserver_url']).'/api/templates/default/images/htmlarea/'.$toolbar.'.svg',
+ 'app' => 'api'
+ );
+ }
+ return $toolbar_selOptions;
+ }
+
/**
* Validate input
*
diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php
index af9ba28cfa..9f1e2d9c20 100644
--- a/mail/inc/class.mail_compose.inc.php
+++ b/mail/inc/class.mail_compose.inc.php
@@ -1394,6 +1394,8 @@ class mail_compose
}
$content['to'] = self::resolveEmailAddressList($content['to']);
+ $content['html_toolbar'] = empty(Mail::$mailConfig['html_toolbar']) ?
+ join(',', Etemplate\Widget\HtmlArea::$toolbar_default_list) : join(',', Mail::$mailConfig['html_toolbar']);
//error_log(__METHOD__.__LINE__.array2string($content));
$etpl->exec('mail.mail_compose.compose',$content,$sel_options,array(),$preserv,2);
}
diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php
index ec2ed3209b..9801584c3b 100644
--- a/mail/inc/class.mail_hooks.inc.php
+++ b/mail/inc/class.mail_hooks.inc.php
@@ -732,4 +732,20 @@ class mail_hooks
]
];
}
+
+ /**
+ * Called before displaying site configuration
+ *
+ * @param array $config
+ * @return array with additional config to merge and "sel_options" values
+ */
+ public static function config(array $config)
+ {
+ return [
+ 'html_toolbar' => empty($config['html_toolbar']) ? join(',', Api\Etemplate\Widget\HtmlArea::$toolbar_default_list) : $config['html_toolbar'],
+ 'sel_options' => [
+ 'html_toolbar' => Api\Etemplate\Widget\HtmlArea::get_toolbar_as_selOptions()
+ ]
+ ];
+ }
}
diff --git a/mail/setup/setup.inc.php b/mail/setup/setup.inc.php
index 0f2bbcf6f5..183f1a97cf 100644
--- a/mail/setup/setup.inc.php
+++ b/mail/setup/setup.inc.php
@@ -37,6 +37,7 @@ $setup_info['mail']['hooks']['clear_cache'] = 'EGroupware\\Api\\Mail::unsetCache
$setup_info['mail']['hooks']['check_notify'] = 'mail_hooks::notification_check_mailbox';
$setup_info['mail']['hooks']['emailadmin_edit'] = 'mail_hooks::emailadmin_edit';
$setup_info['mail']['hooks']['status-get_actions'] = 'mail_hooks::get_status_actions';
+$setup_info['mail']['hooks']['config'] = 'mail_hooks::config';
/* Dependencies for this app to work */
$setup_info['mail']['depends'][] = array(
diff --git a/mail/templates/default/compose.xet b/mail/templates/default/compose.xet
index 1fb6712e6e..8ebdd9ff25 100644
--- a/mail/templates/default/compose.xet
+++ b/mail/templates/default/compose.xet
@@ -87,7 +87,7 @@
-
+
diff --git a/mail/templates/default/config.xet b/mail/templates/default/config.xet
index 1350bed22a..eeb8851f77 100644
--- a/mail/templates/default/config.xet
+++ b/mail/templates/default/config.xet
@@ -83,6 +83,10 @@
+
+
+
+
diff --git a/preferences/inc/class.preferences_hooks.inc.php b/preferences/inc/class.preferences_hooks.inc.php
index ceadd49c5d..66b4f4894b 100644
--- a/preferences/inc/class.preferences_hooks.inc.php
+++ b/preferences/inc/class.preferences_hooks.inc.php
@@ -113,23 +113,6 @@ class preferences_hooks
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'],
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit']);
}
- $rte_toolbar_list = array (
- 'undo', 'redo', 'bold', 'italic', 'strikethrough', 'forecolor', 'backcolor',
- 'link', 'alignleft', 'aligncenter', 'alignright', 'alignjustify',
- 'numlist', 'bullist', 'outdent', 'indent', 'ltr', 'rtl',
- 'removeformat', 'code', 'image', 'searchreplace','formatselect', 'fontselect', 'fontsizeselect', 'fullscreen'
- );
- $rte_toolbar_selOptions = array();
- foreach ($rte_toolbar_list as $toolbar)
- {
- $rte_toolbar_selOptions[$toolbar] = array (
- 'id' => $toolbar,
- 'label' => lang($toolbar),
- 'title' => lang($toolbar),
- 'icon' => Framework::getUrl($GLOBALS['egw_info']['server']['webserver_url']).'/api/templates/default/images/htmlarea/'.$toolbar.'.svg',
- 'app' => 'api'
- );
- }
if (!$GLOBALS['egw_info']['user']['preferences']['common']['rte_toolbar'])
{
@@ -475,7 +458,7 @@ class preferences_hooks
//'multiple' => 'toggle',
'editModeEnabled' => false,
'autocomplete_url' => ' ',
- 'select_options' => $rte_toolbar_selOptions
+ 'select_options' => Api\Etemplate\Widget\HtmlArea::get_toolbar_as_selOptions()
)
)
);