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.
- package/bundles/tnx-shared.umd.js +85 -124
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/components/tn-tinymce/tn-tinymce.component.d.ts.map +1 -1
- package/esm2015/components/tn-dialog/tn-dialog.component.js +2 -2
- package/esm2015/components/tn-tinymce/tn-tinymce.component.js +44 -75
- package/fesm2015/tnx-shared.js +44 -75
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -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
|
-
|
|
49629
|
-
|
|
49630
|
-
|
|
49631
|
-
|
|
49632
|
-
|
|
49633
|
-
|
|
49634
|
-
|
|
49635
|
-
|
|
49636
|
-
|
|
49637
|
-
|
|
49638
|
-
|
|
49639
|
-
|
|
49640
|
-
|
|
49641
|
-
const
|
|
49642
|
-
if (
|
|
49643
|
-
|
|
49644
|
-
|
|
49645
|
-
|
|
49646
|
-
|
|
49647
|
-
|
|
49648
|
-
|
|
49649
|
-
|
|
49650
|
-
|
|
49651
|
-
|
|
49652
|
-
|
|
49653
|
-
|
|
49654
|
-
|
|
49655
|
-
|
|
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
|
-
|
|
49667
|
-
|
|
49668
|
-
|
|
49669
|
-
|
|
49670
|
-
|
|
49671
|
-
|
|
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
|
-
|
|
49675
|
-
|
|
49676
|
-
|
|
49677
|
-
|
|
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
|
}
|