* Mail: Add custom html toolbar settings in mail site-configuration in order to be able to add/remove certain actions only for mail-compose dialog.

This commit is contained in:
Hadi Nategh
2020-09-25 14:17:29 +02:00
parent 3956760c23
commit acbd23a60a
9 changed files with 113 additions and 28 deletions

View File

@@ -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 = <string>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[<string>egw.preference('rte_font_unit', 'common')],
menubar: parseInt(rte_menubar) && this.menubar ? true : typeof rte_menubar != 'undefined' ? false : this.menubar