tnx-shared 5.3.154 → 5.3.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,7 +88,6 @@ import { TriStateCheckboxModule } from 'tn-custom-primeng/tristatecheckbox';
88
88
  import { trigger, transition, style, animate } from '@angular/animations';
89
89
  import { toCanvas } from 'qrcode';
90
90
  import { nanoid } from 'nanoid';
91
- import { RTFJS, WMFJS, EMFJS } from 'rtf.js';
92
91
  import { DragDropModule } from 'tn-custom-primeng/dragdrop';
93
92
 
94
93
  class ComCtxConstants {
@@ -49091,7 +49090,7 @@ class TnDialogComponent {
49091
49090
  TnDialogComponent.decorators = [
49092
49091
  { type: Component, args: [{
49093
49092
  selector: 'tn-dialog',
49094
- template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [header]=\"header | translate\" [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\"\n [autoZIndex]=\"true\" [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
49093
+ template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [header]=\"header | translate\" [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\"\n [autoZIndex]=\"true\" [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
49095
49094
  styles: [""]
49096
49095
  },] }
49097
49096
  ];
@@ -49336,9 +49335,6 @@ class TnTinymceComponent extends ComponentBase {
49336
49335
  height: 650
49337
49336
  });
49338
49337
  this.showTemplate = false;
49339
- RTFJS.loggingEnabled(false);
49340
- WMFJS.loggingEnabled(false);
49341
- EMFJS.loggingEnabled(false);
49342
49338
  const m = ['basic', 'medium', 'full', 'simple'];
49343
49339
  m.forEach(x => {
49344
49340
  this.modes[x] = this.getTinyMceConfigByMode(x);
@@ -49598,86 +49594,59 @@ class TnTinymceComponent extends ComponentBase {
49598
49594
  return __awaiter(this, void 0, void 0, function* () {
49599
49595
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
49600
49596
  const images = [];
49601
- let oldLegacyValue = false;
49602
- const settings = {
49603
- onPicture: (isLegacy, create) => {
49604
- if (oldLegacyValue) {
49605
- oldLegacyValue = false;
49606
- const dom = create();
49607
- images.push(dom.outerHTML);
49608
- return dom;
49609
- }
49610
- else if (!isLegacy) {
49611
- const dom = create();
49612
- if (dom.tagName == 'IMG') {
49613
- images.push(dom.outerHTML);
49614
- return dom;
49615
- }
49616
- else {
49617
- oldLegacyValue = true;
49618
- }
49619
- }
49620
- }
49621
- };
49622
49597
  if (types.indexOf('text/html') !== -1) {
49623
49598
  if (pastedData.indexOf('<v:imagedata ') == -1) {
49624
49599
  resolve(pastedData);
49625
49600
  }
49626
49601
  else {
49627
49602
  if (types.indexOf('text/rtf') !== -1) {
49628
- const doc = new RTFJS.Document(this._commonService.stringToArrayBuffer(pastedRtfData), settings);
49629
- doc.render().then((htmlElements) => __awaiter(this, void 0, void 0, function* () {
49630
- let index = pastedData.indexOf('<v:imagedata ');
49631
- let i = 0;
49632
- const imageUploaded = [];
49633
- let docm = new DOMParser().parseFromString(pastedData, 'text/html');
49634
- let img = docm.getElementsByTagName('img');
49635
- while (index > -1) {
49636
- const p1 = pastedData.substring(0, index);
49637
- const index2 = pastedData.indexOf('/>', index);
49638
- if (index == -1)
49639
- break;
49640
- else {
49641
- const p2 = pastedData.substring(index2 + 2);
49642
- if (images.length > i) {
49643
- const indexImg = images[i].indexOf('<img src=');
49644
- if (indexImg !== -1) {
49645
- images[i] = images[i].substring(indexImg + 10, images[i].length - 2);
49646
- }
49647
- const imageType = images[i].substring(5, images[i].indexOf(';'));
49648
- const base64 = images[i].substring(images[i].indexOf('base64,') + 7);
49649
- const imageBlob = this.dataURItoBlob(base64, imageType);
49650
- const srcArr = img[i].src.split('/');
49651
- const fileName = srcArr[srcArr.length - 1];
49652
- const file = new File([imageBlob], fileName, { type: imageType });
49653
- const uploadImage = yield this._fileObjectService.uploadWithByteArray(file);
49654
- if (typeof uploadImage == 'string') {
49655
- imageUploaded.push(this._fileObjectService.getUrlImage(uploadImage));
49656
- }
49657
- else {
49658
- this._notifierService.showWarning('Upload file thất bại');
49659
- }
49603
+ let index = pastedData.indexOf('<v:imagedata ');
49604
+ let i = 0;
49605
+ const imageUploaded = [];
49606
+ let docm = new DOMParser().parseFromString(pastedData, 'text/html');
49607
+ let img = docm.getElementsByTagName('img');
49608
+ while (index > -1) {
49609
+ const p1 = pastedData.substring(0, index);
49610
+ const index2 = pastedData.indexOf('/>', index);
49611
+ if (index == -1)
49612
+ break;
49613
+ else {
49614
+ const p2 = pastedData.substring(index2 + 2);
49615
+ if (images.length > i) {
49616
+ const indexImg = images[i].indexOf('<img src=');
49617
+ if (indexImg !== -1) {
49618
+ images[i] = images[i].substring(indexImg + 10, images[i].length - 2);
49619
+ }
49620
+ const imageType = images[i].substring(5, images[i].indexOf(';'));
49621
+ const base64 = images[i].substring(images[i].indexOf('base64,') + 7);
49622
+ const imageBlob = this.dataURItoBlob(base64, imageType);
49623
+ const srcArr = img[i].src.split('/');
49624
+ const fileName = srcArr[srcArr.length - 1];
49625
+ const file = new File([imageBlob], fileName, { type: imageType });
49626
+ const uploadImage = yield this._fileObjectService.uploadWithByteArray(file);
49627
+ if (typeof uploadImage == 'string') {
49628
+ imageUploaded.push(this._fileObjectService.getUrlImage(uploadImage));
49629
+ }
49630
+ else {
49631
+ this._notifierService.showWarning('Upload file thất bại');
49660
49632
  }
49661
- pastedData = p1 + '<img src=' + imageUploaded[i] + '/>' + p2;
49662
- index = pastedData.indexOf('<v:imagedata ');
49663
- i++;
49664
49633
  }
49634
+ pastedData = p1 + '<img src=' + imageUploaded[i] + '/>' + p2;
49635
+ index = pastedData.indexOf('<v:imagedata ');
49636
+ i++;
49665
49637
  }
49666
- docm = new DOMParser().parseFromString(pastedData, 'text/html');
49667
- img = docm.getElementsByTagName('img');
49668
- for (let i = 0; i < images.length; i++) {
49669
- if (imageUploaded[i]) {
49670
- img[i].src = imageUploaded[i];
49671
- img[i].alt = imageUploaded[i];
49672
- }
49638
+ }
49639
+ docm = new DOMParser().parseFromString(pastedData, 'text/html');
49640
+ img = docm.getElementsByTagName('img');
49641
+ for (let i = 0; i < images.length; i++) {
49642
+ if (imageUploaded[i]) {
49643
+ img[i].src = imageUploaded[i];
49644
+ img[i].alt = imageUploaded[i];
49673
49645
  }
49674
- let result = '';
49675
- result = new XMLSerializer().serializeToString(docm);
49676
- resolve(result);
49677
- })).catch(err => {
49678
- console.error(err);
49679
- resolve(null);
49680
- });
49646
+ }
49647
+ let result = '';
49648
+ result = new XMLSerializer().serializeToString(docm);
49649
+ resolve(result);
49681
49650
  }
49682
49651
  }
49683
49652
  }