I am trying to add a new Montserrat font in the tinymce editor of composer-email but without success.
Can anyone help me?
I created: source/custom/modules/Emails/clients/base/fields/htmleditable_tinymce/htmleditable_tinymce.js
({
extendsFrom: "EmailsHtmleditable_tinymceField",
getTinyMCEConfig: function () {
return {
// Location of TinyMCE script
script_url: 'include/javascript/tinymce6/tinymce.min.js?v=' + this.tinyMCEVersion,
// Force loading of current version of tinyMCE plugin
cache_suffix: '?v=' + this.tinyMCEVersion,
// General options
theme: 'silver',
skin: app.utils.isDarkMode() ? 'oxide-dark' : 'oxide',
content_css: app.utils.isDarkMode() ? 'dark' : 'default',
plugins: 'code,help,insertdatetime,table,charmap,' +
'image,link,anchor,directionality,searchreplace,lists',
browser_spellcheck: true,
// User Interface options
min_height: 250,
menubar: false,
statusbar: false,
resize: false,
toolbar_mode: 'wrap',
toolbar: 'code | bold italic underline strikethrough | alignleft aligncenter alignright ' +
'alignjustify | forecolor backcolor | fontfamily fontsize blocks | ' +
'cut copy paste pastetext | search searchreplace | bullist numlist | ' +
'outdent indent | ltr rtl | undo redo | link unlink anchor image | subscript ' +
'superscript | charmap | table | hr removeformat | insertdatetime',
font_formats:
"Montserrat=Montserrat,Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Oswald=oswald; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats",
setup: function (ed) {
ed.contentCSS.push("https://fonts.googleapis.com/css2?family=Calibri");
let config = App.metadata.getModule('SYNO_Settings', 'config');
ed.on('init', function () {
this.getDoc().body.style.fontSize = config.email_tinymce_size;
this.getDoc().body.style.fontFamily = config.email_tinymce_font;
});
},
// Sets the text of the Target element of the link plugin. To disable
// this completely, set target_list: false
link_target_list: [
{
text: app.lang.getAppString('LBL_TINYMCE_TARGET_SAME'),
value: ''
},
{
text: app.lang.getAppString('LBL_TINYMCE_TARGET_NEW'),
value: '_blank'
}
],
// Output options
entity_encoding: 'raw',
// URL options
relative_urls: false,
convert_urls: false,
// Insert image
file_browser_callback: _.bind(this.tinyMCEFileBrowseCallback, this),
// Allow image copy&paste
paste_data_images: true,
images_upload_handler: _.bind(this.tinyMCEImagePasteCallback, this)
};
},
})
After I create:
source/custom/Extension/modules/Emails/Ext/Vardefs/description_html.php
<?php $dictionary['Email']['fields']['description_html']['studio']=true; $dictionary['Email']['fields']['description_html']['tinyConfig']= [ 'theme_advanced_fonts' => "Montserrat=Montserrat,Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Oswald=oswald; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats", ];
And I created this: source/custom/include/tinyMCEDefaultConfig.php
<?php $defaultConfig = array( 'theme_advanced_fonts' => "Montserrat=Montserrat,Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Oswald=oswald; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats", );
And nothing happens.
Does anyone know how to add a font in a sugar 12.3 version?
Kind regards,