tnx-shared 5.3.206 → 5.3.207
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 +46 -23
- 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/equation-editor/equation-editor.component.d.ts +2 -2
- package/components/equation-editor/equation-editor.component.d.ts.map +1 -1
- package/components/tn-tinymce/tn-tinymce.component.d.ts.map +1 -1
- package/esm2015/components/equation-editor/equation-editor.component.js +9 -7
- package/esm2015/components/tn-tinymce/tn-tinymce.component.js +42 -20
- package/fesm2015/tnx-shared.js +47 -24
- 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
|
@@ -40810,10 +40810,11 @@ class EquationEditorComponent extends ComponentBase {
|
|
|
40810
40810
|
});
|
|
40811
40811
|
}
|
|
40812
40812
|
onModelChange(evt) {
|
|
40813
|
+
console.log(evt);
|
|
40813
40814
|
clearTimeout(this.timeoutModelChange);
|
|
40814
|
-
if (
|
|
40815
|
+
if (evt && typeof evt == 'string' && evt.trim() != '') {
|
|
40815
40816
|
this.timeoutModelChange = setTimeout(() => {
|
|
40816
|
-
this.showPreview(
|
|
40817
|
+
this.showPreview(evt.trim());
|
|
40817
40818
|
}, 500);
|
|
40818
40819
|
}
|
|
40819
40820
|
}
|
|
@@ -40821,7 +40822,7 @@ class EquationEditorComponent extends ComponentBase {
|
|
|
40821
40822
|
scaleDataURL(dataURL, maxSizeRatio) {
|
|
40822
40823
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40823
40824
|
return new Promise(done => {
|
|
40824
|
-
|
|
40825
|
+
const img = new Image;
|
|
40825
40826
|
img.onload = () => {
|
|
40826
40827
|
let newWidth, newHeight, canvas, ctx;
|
|
40827
40828
|
const maxWidth = img.width * maxSizeRatio;
|
|
@@ -40861,12 +40862,12 @@ EquationEditorComponent.decorators = [
|
|
|
40861
40862
|
selector: 'equation-editor',
|
|
40862
40863
|
template: "<div class=\"ui-fluid\">\n <textarea #textarea class=\"latexContent\" placeholder=\"G\u00F5 c\u00F4ng th\u1EE9c to\u00E1n h\u1ECDc t\u1EA1i \u0111\u00E2y...\" rows=\"6\" pInputTextarea\n (ngModelChange)=\"onModelChange($event)\" [(ngModel)]=\"equationLatex\"></textarea>\n</div>\n<div class=\"preview\">\n <img #preview latex=\"true\" *ngIf=\"imageSrc\" [attr.height]=\"data.height != 0 ? data.height : null\"\n class=\"latex\" [style]=\"data.style | safeStyle\" [src]=\"imageSrc\" [alt]=\"equationLatex\" />\n</div>",
|
|
40863
40864
|
providers: [ComponentContextService],
|
|
40864
|
-
styles: [".btn-equation{width:30px;height:30px;cursor:pointer}.preview{text-align:center;margin
|
|
40865
|
+
styles: [".btn-equation{width:30px;height:30px;cursor:pointer}.preview{text-align:center;margin:20px 10px}.latexContent{resize:none;border-radius:0}textarea{width:100%}"]
|
|
40865
40866
|
},] }
|
|
40866
40867
|
];
|
|
40867
40868
|
EquationEditorComponent.ctorParameters = () => [
|
|
40868
40869
|
{ type: Injector },
|
|
40869
|
-
{ type:
|
|
40870
|
+
{ type: TemplateInstanceService },
|
|
40870
40871
|
{ type: DomSanitizer }
|
|
40871
40872
|
];
|
|
40872
40873
|
EquationEditorComponent.propDecorators = {
|
|
@@ -44699,6 +44700,21 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
44699
44700
|
}
|
|
44700
44701
|
getTinyMceConfigByMode(mode) {
|
|
44701
44702
|
const $this = this;
|
|
44703
|
+
tinymce.PluginManager.add('equation', function (editor) {
|
|
44704
|
+
const openDialog = function () {
|
|
44705
|
+
$this.header = 'Công thức toán học (dùng laTex)';
|
|
44706
|
+
$this.equationFormModel.show = true;
|
|
44707
|
+
$this.popupSize = { width: 1200, height: 700 };
|
|
44708
|
+
};
|
|
44709
|
+
editor.ui.registry.addButton('equation', {
|
|
44710
|
+
tooltip: 'Công thức toán học vào nội dung',
|
|
44711
|
+
// icon: 'insert-character',
|
|
44712
|
+
icon: 'ltr',
|
|
44713
|
+
onAction: function () {
|
|
44714
|
+
openDialog();
|
|
44715
|
+
}
|
|
44716
|
+
});
|
|
44717
|
+
});
|
|
44702
44718
|
tinymce.PluginManager.add('addNews', function (editor) {
|
|
44703
44719
|
const openDialog = function () {
|
|
44704
44720
|
$this.header = 'Thêm/Chọn tin bài';
|
|
@@ -44722,7 +44738,7 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
44722
44738
|
};
|
|
44723
44739
|
editor.ui.registry.addButton('template', {
|
|
44724
44740
|
tooltip: 'Template',
|
|
44725
|
-
icon: '
|
|
44741
|
+
icon: 'template',
|
|
44726
44742
|
onAction: function () {
|
|
44727
44743
|
openDialog();
|
|
44728
44744
|
}
|
|
@@ -44850,33 +44866,34 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
44850
44866
|
},
|
|
44851
44867
|
mobile: {
|
|
44852
44868
|
theme: 'silver',
|
|
44853
|
-
plugins: ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'],
|
|
44869
|
+
plugins: ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor equation'],
|
|
44854
44870
|
}
|
|
44855
44871
|
};
|
|
44856
44872
|
if (mode == 'full') {
|
|
44857
44873
|
config.plugins = [
|
|
44858
|
-
'advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus editFileNew addNews'
|
|
44874
|
+
'advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus editFileNew addNews equation'
|
|
44859
44875
|
];
|
|
44860
|
-
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link editFileNew addNews | print removeformat undo redo | fullscreen ';
|
|
44861
|
-
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
44862
|
-
config.paste_data_images = true;
|
|
44876
|
+
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link editFileNew addNews | print removeformat undo redo | equation | fullscreen ';
|
|
44877
|
+
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | equation | fullscreen';
|
|
44863
44878
|
return config;
|
|
44864
44879
|
}
|
|
44865
44880
|
else if (mode == 'medium') {
|
|
44866
|
-
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
44867
|
-
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link | print removeformat undo redo | fullscreen';
|
|
44868
|
-
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
44869
|
-
config.paste_data_images = true;
|
|
44881
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor equation'];
|
|
44882
|
+
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link | print removeformat undo redo | equation | fullscreen';
|
|
44883
|
+
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | equation | fullscreen';
|
|
44870
44884
|
return config;
|
|
44871
44885
|
}
|
|
44872
44886
|
else if (mode == 'simple') {
|
|
44873
|
-
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
44874
|
-
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
44875
|
-
config.mobile.toolbar = 'fullscreen | bold italic Strikethrough forecolor backcolor | bullist numlist';
|
|
44887
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor equation'];
|
|
44888
|
+
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | equation | fullscreen';
|
|
44889
|
+
config.mobile.toolbar = 'fullscreen | bold italic Strikethrough forecolor backcolor | bullist numlist | equation';
|
|
44890
|
+
return config;
|
|
44891
|
+
}
|
|
44892
|
+
else {
|
|
44893
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor equation'];
|
|
44894
|
+
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor| alignleft aligncenter alignright alignjustify | bullist numlist | equation';
|
|
44895
|
+
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | equation | fullscreen';
|
|
44876
44896
|
}
|
|
44877
|
-
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
44878
|
-
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor| alignleft aligncenter alignright alignjustify | bullist numlist';
|
|
44879
|
-
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
44880
44897
|
config.paste_data_images = true;
|
|
44881
44898
|
return config;
|
|
44882
44899
|
}
|
|
@@ -44899,8 +44916,14 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
44899
44916
|
this.keydown.next({ event: e, topic });
|
|
44900
44917
|
}
|
|
44901
44918
|
handleOk(evt) {
|
|
44902
|
-
const
|
|
44903
|
-
|
|
44919
|
+
const html = this.equationForm.preview.nativeElement;
|
|
44920
|
+
html.height = 41;
|
|
44921
|
+
let data = html.outerHTML;
|
|
44922
|
+
if (data) {
|
|
44923
|
+
data = data.replace(/width\s*=\s*"(.+?)"/g, '');
|
|
44924
|
+
this.editor.insertContent(data);
|
|
44925
|
+
}
|
|
44926
|
+
this.equationFormModel.show = false;
|
|
44904
44927
|
}
|
|
44905
44928
|
focusTrap(event) {
|
|
44906
44929
|
if (this.editor) {
|
|
@@ -45027,7 +45050,7 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
45027
45050
|
TnTinymceComponent.decorators = [
|
|
45028
45051
|
{ type: Component, args: [{
|
|
45029
45052
|
selector: 'tn-tinymce',
|
|
45030
|
-
template: "<input *ngIf=\"!_deviceDetectorService.isDesktop()\" class=\"input-tab-trap\" (focus)=\"focusTrap($event)\" />\n<textarea class=\"tinymce-control\" id={{id}} [ngStyle]=\"{height: height+'px'}\"></textarea>\n<tn-dialog #dialog *ngIf=\"equationFormModel.show\" [closeOnEscape]=\"false\"\n [header]=\"'C\u00F4ng th\u1EE9c to\u00E1n h\u1ECDc (d\u00F9ng laTex)' | translate\" [popupSize]=\"popupSize\">\n <tn-custom-scrollbar #scrollbar>\n <equation-editor [data]=\"dataEquation\">\n </equation-editor>\n </tn-custom-scrollbar>\n <ng-template #footer>\n <button icon=\"fas fa-check\" [disabled]=\"model.submitting\" pButton type=\"button\"
|
|
45053
|
+
template: "<input *ngIf=\"!_deviceDetectorService.isDesktop()\" class=\"input-tab-trap\" (focus)=\"focusTrap($event)\" />\n<textarea class=\"tinymce-control\" id={{id}} [ngStyle]=\"{height: height+'px'}\"></textarea>\n<tn-dialog #dialog *ngIf=\"equationFormModel.show\" [closeOnEscape]=\"false\"\n [header]=\"'C\u00F4ng th\u1EE9c to\u00E1n h\u1ECDc (d\u00F9ng laTex)' | translate\" [popupSize]=\"popupSize\"\n (onHide)=\"equationFormModel.show = false\">\n <tn-custom-scrollbar #scrollbar>\n <equation-editor [data]=\"dataEquation\">\n </equation-editor>\n </tn-custom-scrollbar>\n <ng-template #footer>\n <button icon=\"fas fa-check\" class=\"p-button-text\" [disabled]=\"model.submitting\" pButton type=\"button\"\n (click)=\"handleOk($event)\" [label]=\"'X\u00E1c nh\u1EADn' | translate\"></button>\n <button icon=\"fas fa-undo\" [disabled]=\"model.submitting\" pButton class=\"p-button-text p-button-secondary\"\n type=\"button\" (click)=\"equationFormModel.show = false\" [label]=\"'FORM.CANCEL' | translate\"></button>\n </ng-template>\n</tn-dialog>\n\n<tn-dialog *ngIf=\"isAddNews\" #dialog [styleClass]=\"'address-form'\" [header]=\"header | translate\" [popupSize]=\"popupSize\"\n (onHide)=\"isAddNews = false\">\n <add-news #listBase [languageCode]=\"languageCode\" (showChange)=\"showChanged($event)\"></add-news>\n</tn-dialog>\n\n<tn-dialog *ngIf=\"showTemplate\" #dialog [styleClass]=\"'address-form'\" [header]=\"header | translate\"\n [popupSize]=\"popupSize\" (onHide)=\"showTemplate = false\">\n <tn-template (onChanged)=\"addTemplate($event)\"></tn-template>\n</tn-dialog>\n\n<tn-dialog *ngIf=\"isAddFile\" #dialog [styleClass]=\"'address-form'\" [header]=\"header | translate\" [popupSize]=\"popupSize\"\n (onHide)=\"isAddFile = false\">\n <file-picker-dialog #formBase [parentModel]=\" model\" [parentContext]=\"context\" (closeForm)=\"isAddFile = false\"\n (onCancel)=\"handleRFCancel($event)\" (onChanged)=\"showChanged($event)\">\n </file-picker-dialog>\n</tn-dialog>",
|
|
45031
45054
|
providers: [
|
|
45032
45055
|
{
|
|
45033
45056
|
provide: NG_VALUE_ACCESSOR,
|