Skip to content
Snippets Groups Projects
Commit af9ac52e authored by Vinciane's avatar Vinciane
Browse files

FIX #9511 Refactoring initMce and check doc

parent 354c89e3
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,7 @@
*ngIf="template.template_target=='attachments' || template.template_target==''">{{lang.office}}</mat-radio-button>
<mat-radio-button style="margin-left:10px" color="primary" name="template_type" value="HTML" [checked]="template.template_type=='HTML'"
*ngIf="template.template_target=='sendmail' || template.template_target=='doctypes' || template.template_target == 'notifications' || template.template_target == ''"
(click)="initMce()">{{lang.html}}</mat-radio-button>
(click)="initMce('textarea#templateHtml')">{{lang.html}}</mat-radio-button>
<mat-radio-button style="margin-left:10px" color="primary" name="template_type" value="TXT" [checked]="template.template_type=='TXT'"
*ngIf="template.template_target=='sendmail' || template.template_target=='notes' || template.template_target == ''">{{lang.txt}}</mat-radio-button>
</mat-radio-group>
......@@ -158,7 +158,7 @@
</div>
<div class="form-group" *ngIf="template.template_type=='OFFICE_HTML'">
<mat-tab-group (selectedTabChange)="initMatTabMce()">
<mat-tab-group (selectedTabChange)="initMce('textarea#templateOfficeHtml')">
<mat-tab label="{{lang.electronicTemplate}}">
<div class="form-group" *ngIf="template.template_type=='OFFICE_HTML'">
<div class="col-sm-12">
......
......@@ -90,10 +90,10 @@ export class TemplateAdministrationComponent implements OnInit {
this.headerService.setHeader(this.lang.templateModification, this.template.template_label);
this.loading = false;
if(this.template.template_type=='HTML'){
this.initMce();
this.initMce('textarea#templateHtml');
}
if(this.template.template_type=='OFFICE_HTML'){
this.initMatTabMce();
this.initMce('textarea#templateOfficeHtml');
}
if (this.template.template_style == '') {
this.buttonFileName = this.template.template_file_name;
......@@ -112,48 +112,14 @@ export class TemplateAdministrationComponent implements OnInit {
});
}
initMce() {
initMce(selectorId:string) {
setTimeout(() => {
tinymce.remove('textarea');
//LOAD EDITOR TINYMCE for MAIL SIGN
tinymce.baseURL = "../../node_modules/tinymce";
tinymce.suffix = '.min';
tinymce.init({
selector: "textarea#templateHtml",
statusbar: false,
language: "fr_FR",
language_url: "tools/tinymce/langs/fr_FR.js",
height: "200",
plugins: [
"textcolor",
"autoresize",
"code"
],
external_plugins: {
'bdesk_photo': "../../apps/maarch_entreprise/tools/tinymce/bdesk_photo/plugin.min.js"
},
menubar: false,
toolbar: "undo | bold italic underline | alignleft aligncenter alignright | bdesk_photo | forecolor | code",
theme_buttons1_add: "fontselect,fontsizeselect",
theme_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
theme_buttons2_add: "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
theme_buttons3_add_before: "tablecontrols,separator",
theme_buttons3_add: "separator,print,separator,ltr,rtl,separator,fullscreen,separator,insertlayer,moveforward,movebackward,absolut",
theme_toolbar_align: "left",
theme_advanced_toolbar_location: "top",
theme_styles: "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1"
});
}, 20);
}
initMatTabMce() {
setTimeout(() => {
tinymce.remove('textarea');
//LOAD EDITOR TINYMCE
tinymce.baseURL = "../../node_modules/tinymce";
tinymce.suffix = '.min';
tinymce.init({
selector: "textarea#templateOfficeHtml",
selector: selectorId,
statusbar: false,
language: "fr_FR",
language_url: "tools/tinymce/langs/fr_FR.js",
......@@ -312,11 +278,7 @@ export class TemplateAdministrationComponent implements OnInit {
if (this.template.template_target != 'notifications') {
this.template.template_datasource = 'letterbox_attachment';
}
if (this.creationMode && this.template.template_style != 'uploadFile' && !this.template.jnlpUniqueId && this.template.template_type == 'OFFICE') {
alert(this.lang.editModelFirst);
return;
}
if (this.creationMode && this.template.template_style != 'uploadFile' && !this.template.jnlpUniqueId && this.template.template_type == 'OFFICE_HTML' && this.template.template_style) {
if (this.creationMode && this.template.template_style != 'uploadFile' && !this.template.jnlpUniqueId && (this.template.template_type == 'OFFICE' || (this.template.template_type == 'OFFICE_HTML' && this.template.template_style))) {
alert(this.lang.editModelFirst);
return;
}
......@@ -365,13 +327,13 @@ export class TemplateAdministrationComponent implements OnInit {
this.template.template_type = 'OFFICE';
} else if (this.template.template_target == 'notifications' || this.template.template_target == 'doctypes' || this.template.template_target == 'sendmail') {
this.template.template_type = 'HTML';
this.initMce();
this.initMce('textarea#templateHtml');
} else if (this.template.template_target == 'notes') {
this.template.template_type = 'TXT';
} else if(this.template.template_target == 'acknowledgementReceipt'){
this.template.template_type = 'OFFICE_HTML';
this.template.template_attachment_type = '';
this.initMatTabMce();
this.initMce('textarea#templateOfficeHtml');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment