croco-html 0.0.1

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.
Files changed (100) hide show
  1. package/README.md +24 -0
  2. package/bundles/croco-html.umd.js +2091 -0
  3. package/bundles/croco-html.umd.js.map +1 -0
  4. package/croco-html.d.ts +5 -0
  5. package/esm2015/croco-html.js +5 -0
  6. package/esm2015/lib/components/add-files-btn/add-files-btn.component.js +57 -0
  7. package/esm2015/lib/components/editor/external-video-block/external-video-block.component.js +49 -0
  8. package/esm2015/lib/components/editor/html-raw-editor/html-raw-editor.component.js +29 -0
  9. package/esm2015/lib/components/editor/image-editor/image-editor.component.js +54 -0
  10. package/esm2015/lib/components/editor/index.js +8 -0
  11. package/esm2015/lib/components/editor/main-editor/main-editor.component.js +80 -0
  12. package/esm2015/lib/components/editor/main-editor-block/main-editor-block.component.js +45 -0
  13. package/esm2015/lib/components/editor/text-editor/text-editor.component.js +38 -0
  14. package/esm2015/lib/components/editor/visual-editor/visual-editor.component.js +165 -0
  15. package/esm2015/lib/components/file-id-select/file-id-select.component.js +66 -0
  16. package/esm2015/lib/components/index.js +6 -0
  17. package/esm2015/lib/components/upload-files-btn/upload-files-btn.component.js +58 -0
  18. package/esm2015/lib/components/xml-tags/index.js +9 -0
  19. package/esm2015/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.js +47 -0
  20. package/esm2015/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.js +21 -0
  21. package/esm2015/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.js +22 -0
  22. package/esm2015/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.js +20 -0
  23. package/esm2015/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.js +24 -0
  24. package/esm2015/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.js +24 -0
  25. package/esm2015/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.js +21 -0
  26. package/esm2015/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.js +26 -0
  27. package/esm2015/lib/croco-html.module.js +90 -0
  28. package/esm2015/lib/extensions/AngularMaterialTableMethods.js +64 -0
  29. package/esm2015/lib/extensions/BodyTagsExtensions.js +120 -0
  30. package/esm2015/lib/extensions/BootstrapTableMethods.js +67 -0
  31. package/esm2015/lib/extensions/HtmlExtractionMethods.js +63 -0
  32. package/esm2015/lib/extensions/HtmlRawTagDataConsts.js +4 -0
  33. package/esm2015/lib/extensions/ImageMethods.js +24 -0
  34. package/esm2015/lib/extensions/InterfaceBlock.js +2 -0
  35. package/esm2015/lib/extensions/TableBuilder.js +35 -0
  36. package/esm2015/lib/extensions/TableMethods.js +100 -0
  37. package/esm2015/lib/extensions/TextMethods.js +29 -0
  38. package/esm2015/lib/extensions/TextSimpleMethods.js +78 -0
  39. package/esm2015/lib/extensions/VideoMethods.js +20 -0
  40. package/esm2015/lib/extensions/XmlExtensions.js +26 -0
  41. package/esm2015/lib/extensions/index.js +13 -0
  42. package/esm2015/lib/index.js +113 -0
  43. package/esm2015/lib/models/models.js +2 -0
  44. package/esm2015/lib/pipes/RichTextToHtmlPipe.js +26 -0
  45. package/esm2015/lib/pipes/TagToSpanPipe.js +16 -0
  46. package/esm2015/lib/pipes/ToHtmlBodyTagsPipe.js +17 -0
  47. package/esm2015/lib/pipes/index.js +5 -0
  48. package/esm2015/lib/pipes/to-preview.pipe.js +17 -0
  49. package/esm2015/lib/services/file-upload.service.js +40 -0
  50. package/esm2015/lib/services/files-query.service.js +27 -0
  51. package/esm2015/public-api.js +8 -0
  52. package/fesm2015/croco-html.js +1634 -0
  53. package/fesm2015/croco-html.js.map +1 -0
  54. package/lib/components/add-files-btn/add-files-btn.component.d.ts +18 -0
  55. package/lib/components/editor/external-video-block/external-video-block.component.d.ts +19 -0
  56. package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +11 -0
  57. package/lib/components/editor/image-editor/image-editor.component.d.ts +20 -0
  58. package/lib/components/editor/index.d.ts +7 -0
  59. package/lib/components/editor/main-editor/main-editor.component.d.ts +28 -0
  60. package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +16 -0
  61. package/lib/components/editor/text-editor/text-editor.component.d.ts +14 -0
  62. package/lib/components/editor/visual-editor/visual-editor.component.d.ts +43 -0
  63. package/lib/components/file-id-select/file-id-select.component.d.ts +30 -0
  64. package/lib/components/index.d.ts +5 -0
  65. package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +24 -0
  66. package/lib/components/xml-tags/index.d.ts +8 -0
  67. package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +17 -0
  68. package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +10 -0
  69. package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +10 -0
  70. package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +7 -0
  71. package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +10 -0
  72. package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +7 -0
  73. package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +10 -0
  74. package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +8 -0
  75. package/lib/croco-html.module.d.ts +60 -0
  76. package/lib/extensions/AngularMaterialTableMethods.d.ts +10 -0
  77. package/lib/extensions/BodyTagsExtensions.d.ts +10 -0
  78. package/lib/extensions/BootstrapTableMethods.d.ts +9 -0
  79. package/lib/extensions/HtmlExtractionMethods.d.ts +69 -0
  80. package/lib/extensions/HtmlRawTagDataConsts.d.ts +3 -0
  81. package/lib/extensions/ImageMethods.d.ts +17 -0
  82. package/lib/extensions/InterfaceBlock.d.ts +4 -0
  83. package/lib/extensions/TableBuilder.d.ts +5 -0
  84. package/lib/extensions/TableMethods.d.ts +58 -0
  85. package/lib/extensions/TextMethods.d.ts +19 -0
  86. package/lib/extensions/TextSimpleMethods.d.ts +23 -0
  87. package/lib/extensions/VideoMethods.d.ts +19 -0
  88. package/lib/extensions/XmlExtensions.d.ts +5 -0
  89. package/lib/extensions/index.d.ts +10 -0
  90. package/lib/index.d.ts +20 -0
  91. package/lib/models/models.d.ts +10 -0
  92. package/lib/pipes/RichTextToHtmlPipe.d.ts +8 -0
  93. package/lib/pipes/TagToSpanPipe.d.ts +7 -0
  94. package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +8 -0
  95. package/lib/pipes/index.d.ts +4 -0
  96. package/lib/pipes/to-preview.pipe.d.ts +8 -0
  97. package/lib/services/file-upload.service.d.ts +23 -0
  98. package/lib/services/files-query.service.d.ts +42 -0
  99. package/package.json +23 -0
  100. package/public-api.d.ts +4 -0
@@ -0,0 +1,1634 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Inject, EventEmitter, Component, ViewChild, Input, Output, ViewEncapsulation, Pipe, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common/http';
4
+ import * as i2 from '@angular/material/button';
5
+ import { MatButtonModule } from '@angular/material/button';
6
+ import * as i5$1 from '@angular/forms';
7
+ import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
+ import * as i1$1 from '@angular/platform-browser';
9
+ import * as i2$1 from '@angular/common';
10
+ import { CommonModule } from '@angular/common';
11
+ import * as i5 from '@angular/material/form-field';
12
+ import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i5$2 from '@angular/material/input';
14
+ import { MatInputModule } from '@angular/material/input';
15
+ import * as i4 from '@angular/cdk/text-field';
16
+ import * as i1$2 from '@angular/material/button-toggle';
17
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
18
+ import * as i2$2 from '@angular/material/icon';
19
+ import { MatIconModule } from '@angular/material/icon';
20
+ import * as i3 from '@ng-select/ng-select';
21
+ import { NgSelectModule } from '@ng-select/ng-select';
22
+ import * as i1$4 from 'ngx-clipboard';
23
+ import * as i2$4 from '@angular/material/snack-bar';
24
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
25
+ import * as i3$2 from '@angular/material/tabs';
26
+ import { MatTabsModule } from '@angular/material/tabs';
27
+ import * as i11 from '@angular/cdk/drag-drop';
28
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
29
+ import * as i1$3 from '@angular/material/progress-spinner';
30
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
31
+ import * as i2$3 from '@angular/material/card';
32
+ import { MatCardModule } from '@angular/material/card';
33
+ import * as i3$1 from '@angular/material/chips';
34
+ import { MatChipsModule } from '@angular/material/chips';
35
+ import * as i6 from '@angular/material/select';
36
+ import { MatSelectModule } from '@angular/material/select';
37
+ import * as i7 from '@angular/material/core';
38
+ import { MatNativeDateModule } from '@angular/material/core';
39
+ import * as i1$5 from '@angular/material/table';
40
+ import { MatTableModule } from '@angular/material/table';
41
+ import * as i34 from '@angular/material/tooltip';
42
+ import { MatTooltipModule } from '@angular/material/tooltip';
43
+ import * as i35 from '@angular/material/checkbox';
44
+ import { MatCheckboxModule } from '@angular/material/checkbox';
45
+ import * as i47 from '@angular/material/autocomplete';
46
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
47
+ import * as i42 from '@angular/material/datepicker';
48
+ import { MatDatepickerModule } from '@angular/material/datepicker';
49
+ import * as i40 from '@angular/material/dialog';
50
+ import { MatDialogModule } from '@angular/material/dialog';
51
+ import * as i25 from '@angular/material/expansion';
52
+ import { MatExpansionModule } from '@angular/material/expansion';
53
+ import * as i43 from '@angular/material/grid-list';
54
+ import { MatGridListModule } from '@angular/material/grid-list';
55
+ import * as i37 from '@angular/material/list';
56
+ import { MatListModule } from '@angular/material/list';
57
+ import * as i31 from '@angular/material/menu';
58
+ import { MatMenuModule } from '@angular/material/menu';
59
+ import * as i41 from '@angular/material/paginator';
60
+ import { MatPaginatorModule } from '@angular/material/paginator';
61
+ import * as i28 from '@angular/material/progress-bar';
62
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
63
+ import * as i48 from '@angular/material/sidenav';
64
+ import { MatSidenavModule } from '@angular/material/sidenav';
65
+ import * as i44 from '@angular/material/slide-toggle';
66
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
67
+ import * as i45 from '@angular/material/tree';
68
+ import { MatTreeModule } from '@angular/material/tree';
69
+ import * as i23 from '@angular/material/badge';
70
+ import { MatBadgeModule } from '@angular/material/badge';
71
+
72
+ class FileImageTagDataConsts {
73
+ }
74
+ FileImageTagDataConsts.TagName = "file-image";
75
+ FileImageTagDataConsts.FileIdAttrName = "file-id";
76
+ class ImageMethods {
77
+ static buildUrl(fileId) {
78
+ return `/FileCopies/Images/Medium/${fileId}.jpg`;
79
+ }
80
+ static buildSmallUrl(fileId) {
81
+ return `/FileCopies/Images/Small/${fileId}.jpg`;
82
+ }
83
+ static ExtractImage(elem) {
84
+ let fileId = +elem.getAttribute(FileImageTagDataConsts.FileIdAttrName);
85
+ let src = ImageMethods.buildUrl(fileId);
86
+ return {
87
+ type: FileImageTagDataConsts.TagName,
88
+ data: {
89
+ src,
90
+ fileId: fileId,
91
+ }
92
+ };
93
+ }
94
+ }
95
+
96
+ class FileUploadService {
97
+ constructor(_httpClient, baseUrl) {
98
+ this._httpClient = _httpClient;
99
+ this.baseUrl = baseUrl;
100
+ }
101
+ postFile(file, createLocalCopiesNow = false) {
102
+ const formData = new FormData();
103
+ formData.append(`fileKey1`, file, file.name);
104
+ return this.postFilesInner(formData, createLocalCopiesNow);
105
+ }
106
+ postFiles(files, createLocalCopiesNow = false) {
107
+ const formData = new FormData();
108
+ for (let i = 0; i < files.length; i++) {
109
+ var fileToUpload = files.item(i);
110
+ formData.append(`fileKey${i}`, fileToUpload, fileToUpload === null || fileToUpload === void 0 ? void 0 : fileToUpload.name);
111
+ }
112
+ return this.postFilesInner(formData, createLocalCopiesNow);
113
+ }
114
+ postFilesInner(formData, createLocalCopiesNow = false) {
115
+ let endpoint = this.baseUrl + 'Api/Files/UploadFiles';
116
+ if (createLocalCopiesNow) {
117
+ endpoint += '/Now';
118
+ }
119
+ return this._httpClient
120
+ .post(endpoint, formData);
121
+ }
122
+ }
123
+ FileUploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FileUploadService, deps: [{ token: i1.HttpClient }, { token: 'BASE_URL' }], target: i0.ɵɵFactoryTarget.Injectable });
124
+ FileUploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FileUploadService, providedIn: 'root' });
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FileUploadService, decorators: [{
126
+ type: Injectable,
127
+ args: [{ providedIn: 'root' }]
128
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
129
+ type: Inject,
130
+ args: ['BASE_URL']
131
+ }] }]; } });
132
+
133
+ class UploadFilesBtnComponent {
134
+ constructor(_fileUploadService) {
135
+ this._fileUploadService = _fileUploadService;
136
+ this.extAccepts = "*/*";
137
+ this.isMultiple = true;
138
+ this.btnText = "Загрузить файлы";
139
+ this.createLocalCopiesNow = false;
140
+ this.hidden = false;
141
+ this.postFilesStarted = new EventEmitter();
142
+ this.onFilesUploaded = new EventEmitter();
143
+ }
144
+ handleFileInput(files) {
145
+ this.postFilesStarted.emit({
146
+ filesCount: files.length,
147
+ createLocalCopiesNow: this.createLocalCopiesNow
148
+ });
149
+ this._fileUploadService.postFiles(files, this.createLocalCopiesNow).subscribe(data => {
150
+ this.onFilesUploaded.emit(data);
151
+ });
152
+ }
153
+ clickFileInput() {
154
+ this.fileInput.nativeElement.click();
155
+ }
156
+ ngOnInit() {
157
+ }
158
+ }
159
+ UploadFilesBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: UploadFilesBtnComponent, deps: [{ token: FileUploadService }], target: i0.ɵɵFactoryTarget.Component });
160
+ UploadFilesBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: UploadFilesBtnComponent, selector: "app-upload-files-btn", inputs: { extAccepts: "extAccepts", isMultiple: "isMultiple", btnText: "btnText", createLocalCopiesNow: "createLocalCopiesNow", hidden: "hidden" }, outputs: { postFilesStarted: "postFilesStarted", onFilesUploaded: "onFilesUploaded" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["filesInput"], descendants: true }], ngImport: i0, template: "<button [hidden]=\"hidden\" mat-raised-button color=\"primary\" (click)=\"filesInput.click()\">{{btnText}}</button>\n<input [hidden]=\"true\" [accept]=\"extAccepts\" [multiple]=\"isMultiple\" type=\"file\" #filesInput (change)=\"handleFileInput($event.target.files)\" />", styles: [""], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: UploadFilesBtnComponent, decorators: [{
162
+ type: Component,
163
+ args: [{
164
+ selector: 'app-upload-files-btn',
165
+ templateUrl: './upload-files-btn.component.html',
166
+ styleUrls: ['./upload-files-btn.component.css']
167
+ }]
168
+ }], ctorParameters: function () { return [{ type: FileUploadService }]; }, propDecorators: { fileInput: [{
169
+ type: ViewChild,
170
+ args: ['filesInput']
171
+ }], extAccepts: [{
172
+ type: Input
173
+ }], isMultiple: [{
174
+ type: Input
175
+ }], btnText: [{
176
+ type: Input
177
+ }], createLocalCopiesNow: [{
178
+ type: Input
179
+ }], hidden: [{
180
+ type: Input
181
+ }], postFilesStarted: [{
182
+ type: Output
183
+ }], onFilesUploaded: [{
184
+ type: Output
185
+ }] } });
186
+
187
+ class AddFilesBtnComponent {
188
+ constructor() {
189
+ this.postFilesStarted = new EventEmitter();
190
+ this.fileIds = [];
191
+ this.filesTagsReady = new EventEmitter();
192
+ }
193
+ postFilesStartedEventHandler(data) {
194
+ this.postFilesStarted.emit(data);
195
+ }
196
+ filesUploadedHandler(data) {
197
+ this.fileIds = data.responseObject;
198
+ let fileTags = [];
199
+ for (let i = 0; i < this.fileIds.length; i++) {
200
+ let fileTag = {
201
+ presentOrEdit: true,
202
+ tagDescription: {
203
+ tag: FileImageTagDataConsts.TagName,
204
+ displayValue: "Изображение"
205
+ },
206
+ attributes: {
207
+ [FileImageTagDataConsts.FileIdAttrName]: this.fileIds[i]
208
+ },
209
+ innerHtml: ""
210
+ };
211
+ fileTags.push(fileTag);
212
+ }
213
+ this.filesTagsReady.emit(fileTags);
214
+ }
215
+ handleClick() {
216
+ this.fakeBtn.clickFileInput();
217
+ }
218
+ ngOnInit() {
219
+ }
220
+ }
221
+ AddFilesBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: AddFilesBtnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
222
+ AddFilesBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AddFilesBtnComponent, selector: "croco-add-files-btn", outputs: { postFilesStarted: "postFilesStarted", filesTagsReady: "filesTagsReady" }, viewQueries: [{ propertyName: "fakeBtn", first: true, predicate: ["fakeBtn"], descendants: true }], ngImport: i0, template: "<div [hidden]=\"true\">\n <app-upload-files-btn #fakeBtn \n (onFilesUploaded)=\"filesUploadedHandler($event)\" \n [btnText]=\"'\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F'\"\n [createLocalCopiesNow]=\"true\"\n (postFilesStarted)=\"postFilesStartedEventHandler($event)\" \n [extAccepts]=\"'image/*'\"></app-upload-files-btn>\n</div>\n\n<div>\n <button class=\"w-100\" \n (click)=\"handleClick()\"\n mat-stroked-button>\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F</button>\n</div>", styles: [""], components: [{ type: UploadFilesBtnComponent, selector: "app-upload-files-btn", inputs: ["extAccepts", "isMultiple", "btnText", "createLocalCopiesNow", "hidden"], outputs: ["postFilesStarted", "onFilesUploaded"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: AddFilesBtnComponent, decorators: [{
224
+ type: Component,
225
+ args: [{
226
+ selector: 'croco-add-files-btn',
227
+ templateUrl: './add-files-btn.component.html',
228
+ styleUrls: ['./add-files-btn.component.css']
229
+ }]
230
+ }], ctorParameters: function () { return []; }, propDecorators: { postFilesStarted: [{
231
+ type: Output
232
+ }], fakeBtn: [{
233
+ type: ViewChild,
234
+ args: ["fakeBtn"]
235
+ }], filesTagsReady: [{
236
+ type: Output
237
+ }] } });
238
+
239
+ class ExternalVideoTagDataConsts {
240
+ }
241
+ ExternalVideoTagDataConsts.TagName = "external-video";
242
+ ExternalVideoTagDataConsts.VideoTypeAttrName = "type";
243
+ ExternalVideoTagDataConsts.LinkAttrName = "link";
244
+ class ExternalVideoSupportedTypes {
245
+ }
246
+ ExternalVideoSupportedTypes.Youtube = "youtube";
247
+ class VideoMethods {
248
+ static ExtractExternalVideoTag(elem) {
249
+ return {
250
+ type: ExternalVideoTagDataConsts.TagName,
251
+ data: {
252
+ type: elem.getAttribute(ExternalVideoTagDataConsts.VideoTypeAttrName),
253
+ link: elem.getAttribute(ExternalVideoTagDataConsts.LinkAttrName)
254
+ }
255
+ };
256
+ }
257
+ }
258
+
259
+ class XmlTagExternalVideoComponent {
260
+ constructor(_domSanitizer) {
261
+ this._domSanitizer = _domSanitizer;
262
+ }
263
+ getYouTubeId(youtubeLink) {
264
+ //https://www.youtube.com/watch?v=l3KfbfkxJOU
265
+ if (youtubeLink.includes("watch?v=")) {
266
+ var url = new URL(youtubeLink);
267
+ return url.searchParams.get("v");
268
+ }
269
+ //https://youtu.be/jzBneaWSswY
270
+ let bits = youtubeLink.split('/');
271
+ return bits[bits.length - 1];
272
+ }
273
+ getWidgetLink(youtubeLink) {
274
+ let id = this.getYouTubeId(youtubeLink);
275
+ let result = `https://www.youtube.com/embed/${id}?controls=0`;
276
+ this.widgetUrl = this._domSanitizer.bypassSecurityTrustResourceUrl(result);
277
+ return result;
278
+ }
279
+ ngOnInit() {
280
+ if (this.data != null) {
281
+ this.tagData = this.data.data;
282
+ }
283
+ let youtubeWidgetLink = this.getWidgetLink(this.tagData.link);
284
+ this.widgetUrl = this._domSanitizer.bypassSecurityTrustResourceUrl(youtubeWidgetLink);
285
+ }
286
+ }
287
+ XmlTagExternalVideoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagExternalVideoComponent, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
288
+ XmlTagExternalVideoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagExternalVideoComponent, selector: "croco-html-xml-tag-external-video", inputs: { data: "data", tagData: "tagData" }, ngImport: i0, template: "<div class=\"d-flex justify-content-center\">\n <div *ngIf=\"widgetUrl\" class=\"y-video\">\n <iframe width=\"100%\" height=\"100%\" [src]=\"widgetUrl\"\n title=\"YouTube video player\" frameborder=\"0\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowfullscreen></iframe>\n </div>\n</div>", styles: ["@media only screen and (min-width: 769px){.y-video{width:640px;height:360px;margin:0 auto}}@media only screen and (max-width: 768px){.y-video{width:560px;height:315px;margin:0 auto}}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagExternalVideoComponent, decorators: [{
290
+ type: Component,
291
+ args: [{
292
+ selector: 'croco-html-xml-tag-external-video',
293
+ templateUrl: './xml-tag-external-video.component.html',
294
+ styleUrls: ['./xml-tag-external-video.component.css']
295
+ }]
296
+ }], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; }, propDecorators: { data: [{
297
+ type: Input
298
+ }], tagData: [{
299
+ type: Input
300
+ }] } });
301
+
302
+ class ExternalVideoBlockComponent {
303
+ constructor() {
304
+ this.onTagUpdated = new EventEmitter();
305
+ this.myForm = new FormGroup({
306
+ youtubeLink: new FormControl()
307
+ });
308
+ this.defaultLink = "https://youtu.be/jzBneaWSswY";
309
+ this.data = {
310
+ youtubeLink: this.defaultLink
311
+ };
312
+ this.tagData = {
313
+ link: this.defaultLink,
314
+ type: ExternalVideoSupportedTypes.Youtube
315
+ };
316
+ }
317
+ linkChanged() {
318
+ this.tagData.link = this.data.youtubeLink;
319
+ this.tag.attributes = this.tagData;
320
+ }
321
+ ngOnInit() {
322
+ this.linkChanged();
323
+ this.tagData = this.tag.attributes;
324
+ this.data.youtubeLink = this.tagData.link;
325
+ }
326
+ }
327
+ ExternalVideoBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ExternalVideoBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
328
+ ExternalVideoBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ExternalVideoBlockComponent, selector: "croco-html-external-video-block", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, ngImport: i0, template: "<div *ngIf=\"tag.presentOrEdit\">\n \n <div>\n \u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 YouTube: {{data.youtubeLink}}\n </div>\n\n <div style=\"height: 10px;\"></div>\n\n <croco-html-xml-tag-external-video [tagData]=\"tagData\">\n </croco-html-xml-tag-external-video>\n</div>\n\n<div *ngIf=\"!tag.presentOrEdit\">\n <div>\n <form [formGroup]=\"myForm\">\n <mat-form-field class=\"w-100\">\n <input matInput placeholder=\"\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 YouTube\"\n new-autocomplete=\"off\"\n autocomplete=\"off\"\n formControlName=\"youtubeLink\"\n [(ngModel)]=\"data.youtubeLink\"\n (ngModelChange)=\"linkChanged()\">\n </mat-form-field>\n </form>\n </div>\n</div>\n\n", styles: [""], components: [{ type: XmlTagExternalVideoComponent, selector: "croco-html-xml-tag-external-video", inputs: ["data", "tagData"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }] });
329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ExternalVideoBlockComponent, decorators: [{
330
+ type: Component,
331
+ args: [{
332
+ selector: 'croco-html-external-video-block',
333
+ templateUrl: './external-video-block.component.html',
334
+ styleUrls: ['./external-video-block.component.css']
335
+ }]
336
+ }], propDecorators: { tag: [{
337
+ type: Input
338
+ }], onTagUpdated: [{
339
+ type: Output
340
+ }] } });
341
+
342
+ class HtmlRawEditorComponent {
343
+ constructor() {
344
+ this.onTagUpdated = new EventEmitter();
345
+ }
346
+ ngOnInit() {
347
+ }
348
+ }
349
+ HtmlRawEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: HtmlRawEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
350
+ HtmlRawEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: HtmlRawEditorComponent, selector: "croco-html-html-raw-editor", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, ngImport: i0, template: "<div *ngIf=\"tag.presentOrEdit\">\n <div [innerHTML]=\"tag.innerHtml\"></div>\n</div>\n\n<div *ngIf=\"!tag.presentOrEdit\">\n <div style=\"height: 10px;\">\n </div>\n <div>\n <mat-form-field class=\"w-100\">\n <textarea matInput cdkTextareaAutosize #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n placeholder=\"\u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u0433\u0430\"\n [(ngModel)]=\"tag.innerHtml\"></textarea>\n </mat-form-field>\n </div>\n</div>\n\n", styles: [""], components: [{ type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: HtmlRawEditorComponent, decorators: [{
352
+ type: Component,
353
+ args: [{
354
+ selector: 'croco-html-html-raw-editor',
355
+ templateUrl: './html-raw-editor.component.html',
356
+ styleUrls: ['./html-raw-editor.component.css']
357
+ }]
358
+ }], ctorParameters: function () { return []; }, propDecorators: { tag: [{
359
+ type: Input
360
+ }], onTagUpdated: [{
361
+ type: Output
362
+ }] } });
363
+
364
+ class FilesQueryService {
365
+ constructor(_httpClient, baseUrl) {
366
+ this._httpClient = _httpClient;
367
+ this._baseControllerUrl = baseUrl + 'Api/Files/';
368
+ }
369
+ getFilesWithRelations(model) {
370
+ return this._httpClient.post(this._baseControllerUrl + `GetFiles/WithRelations`, model);
371
+ }
372
+ getFiles(model) {
373
+ return this._httpClient.post(this._baseControllerUrl + `GetFiles`, model);
374
+ }
375
+ }
376
+ FilesQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FilesQueryService, deps: [{ token: i1.HttpClient }, { token: 'BASE_URL' }], target: i0.ɵɵFactoryTarget.Injectable });
377
+ FilesQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FilesQueryService, providedIn: 'root' });
378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FilesQueryService, decorators: [{
379
+ type: Injectable,
380
+ args: [{
381
+ providedIn: 'root'
382
+ }]
383
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
384
+ type: Inject,
385
+ args: ['BASE_URL']
386
+ }] }]; } });
387
+
388
+ class FileIdSelectComponent {
389
+ constructor(fb, _fileService) {
390
+ this.fb = fb;
391
+ this._fileService = _fileService;
392
+ this.labelText = "Поиск файлов";
393
+ this.loading = false;
394
+ this.files = [];
395
+ this.onFileIdChanged = new EventEmitter();
396
+ this.form = this.fb.group({
397
+ fileName: '',
398
+ });
399
+ }
400
+ onModelChanged(fileId) {
401
+ this.onFileIdChanged.emit(fileId);
402
+ }
403
+ getSrc(fileId) {
404
+ return ImageMethods.buildSmallUrl(fileId);
405
+ }
406
+ ngOnInit() {
407
+ this.loadFiles();
408
+ }
409
+ loadFiles() {
410
+ this.loading = true;
411
+ this._fileService.getFiles({
412
+ count: 10,
413
+ offSet: 0,
414
+ fileName: null,
415
+ q: this.q
416
+ }).subscribe(data => {
417
+ this.files = [...data.list];
418
+ this.loading = false;
419
+ });
420
+ }
421
+ onSearchChanged(q) {
422
+ this.q = q.term;
423
+ this.loadFiles();
424
+ }
425
+ ngOnChanges(changes) {
426
+ this.loadFiles();
427
+ }
428
+ }
429
+ FileIdSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FileIdSelectComponent, deps: [{ token: i5$1.FormBuilder }, { token: FilesQueryService }], target: i0.ɵɵFactoryTarget.Component });
430
+ FileIdSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: FileIdSelectComponent, selector: "croco-html-file-id-select", inputs: { labelText: "labelText", fileId: "fileId" }, outputs: { fileId: "fileId", onFileIdChanged: "onFileIdChanged" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"form\">\n <div class=\"form-group\">\n <label for=\"fileName\">{{labelText}}</label>\n <ng-select [(ngModel)]=\"fileId\" (ngModelChange)=\"onModelChanged($event)\"\n [items]=\"files\"\n #select\n bindLabel=\"fileName\"\n (search)=\"onSearchChanged($event)\"\n [loading]=\"loading\"\n [loadingText]=\"'\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044E \u0444\u0430\u0439\u043B\u044B'\"\n dropdownPosition=\"auto\"\n bindValue=\"fileId\"\n labelForId=\"fileName\"\n placeholder=\"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0444\u0430\u0439\u043B\"\n [virtualScroll]=\"true\"\n formControlName=\"fileName\">\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n <div>\n <img class=\"mx-auto d-block img-fluid\" [src]=\"getSrc(item.fileId)\"/>\n </div>\n <div>\n <span class=\"h5\">\u0424\u0430\u0439\u043B: </span>\n <span class=\"h5\" [ngOptionHighlight]=\"search\"><b>{{item.fileName}}</b></span>\n </div>\n <div>\n <small>\n <span>\n \u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u0444\u0430\u0439\u043B\u0430: <b>{{item.fileId}}</b>\n </span>\n </small>\n </div>\n </ng-template>\n </ng-select>\n </div>\n</form>\n\n<div>\n \u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u0444\u0430\u0439\u043B\u0430: {{fileId}}\n</div>\n", styles: [""], components: [{ type: i3.NgSelectComponent, selector: "ng-select", inputs: ["markFirst", "dropdownPosition", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "bufferAmount", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "bindLabel", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "virtualScroll", "openOnEnter", "appendTo", "bindValue", "appearance", "maxSelectedItems", "groupBy", "groupValue", "tabIndex", "typeahead"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }], directives: [{ type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.ɵf, selector: "[ng-option-tmp]" }] });
431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: FileIdSelectComponent, decorators: [{
432
+ type: Component,
433
+ args: [{
434
+ selector: 'croco-html-file-id-select',
435
+ templateUrl: './file-id-select.component.html',
436
+ styleUrls: ['./file-id-select.component.css']
437
+ }]
438
+ }], ctorParameters: function () { return [{ type: i5$1.FormBuilder }, { type: FilesQueryService }]; }, propDecorators: { labelText: [{
439
+ type: Input
440
+ }], fileId: [{
441
+ type: Input
442
+ }, {
443
+ type: Output
444
+ }], onFileIdChanged: [{
445
+ type: Output
446
+ }] } });
447
+
448
+ class ImageEditorComponent {
449
+ constructor() {
450
+ this.hasImageError = false;
451
+ this.searchOrEdit = "search";
452
+ this.myForm = new FormGroup({
453
+ fileId: new FormControl()
454
+ });
455
+ this.onTagUpdated = new EventEmitter();
456
+ }
457
+ onErrorHandler() {
458
+ this.hasImageError = true;
459
+ }
460
+ getSrc() {
461
+ return ImageMethods.buildUrl(this.tag.attributes[FileImageTagDataConsts.FileIdAttrName]);
462
+ }
463
+ hasFileId() {
464
+ return this.tag.attributes.hasOwnProperty(FileImageTagDataConsts.FileIdAttrName) && !isNaN(this.tag.attributes[FileImageTagDataConsts.FileIdAttrName]);
465
+ }
466
+ onFileIdChanged(fileId) {
467
+ this.tag.attributes[FileImageTagDataConsts.FileIdAttrName] = fileId;
468
+ this.removeImageError();
469
+ }
470
+ removeImageError() {
471
+ this.hasImageError = false;
472
+ }
473
+ ngOnInit() {
474
+ }
475
+ }
476
+ ImageEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ImageEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
477
+ ImageEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ImageEditorComponent, selector: "croco-html-image-editor", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, ngImport: i0, template: "<div>\n <div style=\"height: 10px;\">\n </div>\n \n <div *ngIf=\"hasImageError\" class=\"error-block\">\n \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043F\u043E \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u043C\u0443 \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0443, \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0444\u0430\u0439\u043B \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043B\u0438 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.\n </div>\n\n <div *ngIf=\"hasFileId() && !hasImageError\">\n <img class=\"mx-auto d-block img-fluid\" [src]=\"getSrc()\" (error)=\"onErrorHandler()\"/>\n </div>\n\n <div *ngIf=\"!hasFileId()\">\n <h5>[\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E]</h5>\n </div>\n</div>\n\n<div *ngIf=\"!tag.presentOrEdit\">\n <div style=\"height: 10px;\"></div>\n\n <div style=\"overflow-x:auto;\">\n <mat-button-toggle-group [(ngModel)]=\"searchOrEdit\">\n <mat-button-toggle value=\"search\">\n \u0418\u0441\u043A\u0430\u0442\u044C \u0444\u0430\u0439\u043B <mat-icon>search</mat-icon>\n </mat-button-toggle>\n <mat-button-toggle value=\"edit\">\n \u0423\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u043E \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0443 <mat-icon>settings</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n \n\n <div style=\"height: 10px;\"></div>\n\n <div [hidden]=\"searchOrEdit !== 'search'\">\n <croco-html-file-id-select\n [labelText]=\"'\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0444\u0430\u0439\u043B'\"\n [(fileId)]=\"tag.attributes['file-id']\"\n (onFileIdChanged)=\"onFileIdChanged($event)\">\n </croco-html-file-id-select>\n </div>\n\n <div [hidden]=\"searchOrEdit !== 'edit'\">\n <form [formGroup]=\"myForm\">\n <mat-form-field class=\"w-100\">\n <input matInput placeholder=\"\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u0444\u0430\u0439\u043B\u0430\" new-autocomplete=\"off\" autocomplete=\"off\"\n formControlName=\"fileId\" \n type=\"number\"\n [(ngModel)]=\"tag.attributes['file-id']\"\n (ngModelChange)=\"removeImageError()\">\n </mat-form-field>\n </form>\n </div>\n</div>", styles: [".error-block{background-color:#f32323;color:#fff;text-align:center;border-radius:10px;padding:10px}\n"], components: [{ type: i1$2.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: FileIdSelectComponent, selector: "croco-html-file-id-select", inputs: ["labelText", "fileId"], outputs: ["fileId", "onFileIdChanged"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$2.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }] });
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ImageEditorComponent, decorators: [{
479
+ type: Component,
480
+ args: [{
481
+ selector: 'croco-html-image-editor',
482
+ templateUrl: './image-editor.component.html',
483
+ styleUrls: ['./image-editor.component.css']
484
+ }]
485
+ }], ctorParameters: function () { return []; }, propDecorators: { tag: [{
486
+ type: Input
487
+ }], onTagUpdated: [{
488
+ type: Output
489
+ }] } });
490
+
491
+ class AngularMaterialTableMethods {
492
+ static getAngularMaterialTableData(columns, rows) {
493
+ let data = [];
494
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
495
+ const row = rows[rowIndex];
496
+ var elem = {};
497
+ for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {
498
+ const column = columns[columnIndex];
499
+ elem[column] = row.columns[columnIndex].data.text;
500
+ }
501
+ data.push(elem);
502
+ }
503
+ return {
504
+ displayedColumns: columns,
505
+ data: data,
506
+ };
507
+ }
508
+ static checkHeaders(tableData) {
509
+ if (tableData.header === null) {
510
+ return {
511
+ isSucceeded: false,
512
+ message: "Необходимо указать заголовок таблицы"
513
+ };
514
+ }
515
+ let columns = tableData.header.columns;
516
+ var uniqueDislayedColumns = columns.filter((v, i, a) => a.indexOf(v) === i);
517
+ if (uniqueDislayedColumns.length !== columns.length) {
518
+ return {
519
+ isSucceeded: false,
520
+ message: "Ошибка при обработке разметки таблицы. Обнаружены дубликаты заголовков."
521
+ };
522
+ }
523
+ return {
524
+ isSucceeded: true,
525
+ message: "Ok"
526
+ };
527
+ }
528
+ static checkAngularMaterialTableData(tableData, checkHeaders = true) {
529
+ if (checkHeaders) {
530
+ var checkHeadersResult = this.checkHeaders(tableData);
531
+ if (!checkHeadersResult.isSucceeded) {
532
+ return checkHeadersResult;
533
+ }
534
+ }
535
+ let rows = tableData.rows;
536
+ let columns = tableData.header.columns;
537
+ for (let i = 0; i < rows.length; i++) {
538
+ const row = rows[i];
539
+ if (row.columns.length !== columns.length) {
540
+ return {
541
+ isSucceeded: false,
542
+ message: `Ошибка при обработке разметки таблицы. `
543
+ + `Количество колонок в каждой строке таблицы должно соотвествовать количеству колонок указанных в заголовке. `
544
+ + `В строке таблицы №${i + 1} количество колонок = ${row.columns.length}, а должно быть ${columns.length}.`
545
+ };
546
+ }
547
+ }
548
+ return {
549
+ isSucceeded: true,
550
+ message: "Ok"
551
+ };
552
+ }
553
+ }
554
+
555
+ const TextTag = "text";
556
+ class TextSimpleMethods {
557
+ static ExtractTextTag(elem) {
558
+ var _a;
559
+ var hAlignValue = (_a = elem.getAttribute("h-align")) !== null && _a !== void 0 ? _a : "left";
560
+ var data = {
561
+ textTagName: elem.tagName.toLowerCase(),
562
+ text: elem.innerText.trim().replace('\n\t', ''),
563
+ html: elem.innerHTML.trim().replace('\n\t', ''),
564
+ horizontalAlignment: hAlignValue,
565
+ validationResult: {
566
+ isSucceeded: true,
567
+ message: "Ok"
568
+ }
569
+ };
570
+ let result = {
571
+ type: TextTag,
572
+ data: data
573
+ };
574
+ if (result.data.text === '\n') {
575
+ result.data.text = '';
576
+ }
577
+ if (result.data.html === '\n') {
578
+ result.data.html = '';
579
+ }
580
+ var alignmentVals = ["left", "right", "center"];
581
+ if (alignmentVals.indexOf(hAlignValue) < 0) {
582
+ result.data.validationResult = {
583
+ isSucceeded: false,
584
+ message: `Недопустимое значение атрибута h-align. Допустимые значения: ${alignmentVals.join(', ')}. `
585
+ + 'Данный тег можно не указывать, по-умолчанию будет применено выравнивание слева.'
586
+ };
587
+ }
588
+ var html = result.data.html;
589
+ var htmlValidation = this.ValidateTextHtml(html);
590
+ if (!htmlValidation.isSucceeded) {
591
+ result.data.validationResult = htmlValidation;
592
+ }
593
+ return result;
594
+ }
595
+ static ValidateTextHtml(html) {
596
+ var p = document.createElement("p");
597
+ p.innerHTML = html;
598
+ for (let i = 0; i < p.children.length; i++) {
599
+ const element = p.children.item(i);
600
+ var validationResult = this.ValidateTag(element);
601
+ if (!validationResult.isSucceeded) {
602
+ return validationResult;
603
+ }
604
+ }
605
+ return {
606
+ isSucceeded: true,
607
+ message: `Ok`
608
+ };
609
+ }
610
+ static ValidateTag(element) {
611
+ let lowerTag = element.tagName.toLowerCase();
612
+ if (!this.supportedTags.includes(lowerTag)) {
613
+ return {
614
+ isSucceeded: false,
615
+ message: `Тег <${lowerTag}> не поддерживается внутри тега <text>`
616
+ };
617
+ }
618
+ for (let i = 0; i < element.children.length; i++) {
619
+ const nElement = element.children.item(i);
620
+ var innerValidationResult = this.ValidateTag(nElement);
621
+ if (!innerValidationResult.isSucceeded) {
622
+ return innerValidationResult;
623
+ }
624
+ }
625
+ return {
626
+ isSucceeded: true,
627
+ message: "Ok"
628
+ };
629
+ }
630
+ }
631
+ TextSimpleMethods.supportedTags = ["sup", "sub", "strong", "b", "i"];
632
+
633
+ class BootstrapTableMethods {
634
+ static BuildTable(data) {
635
+ let result = `<table class="table table-bordered">`;
636
+ result += this.BuildHeader(data.header);
637
+ result += this.BuildBody(data.rows);
638
+ result += "</table>";
639
+ return result;
640
+ }
641
+ static BuildHeader(data) {
642
+ if (data === null) {
643
+ return "";
644
+ }
645
+ let result = "<thead>";
646
+ result += "<tr>";
647
+ for (let index = 0; index < data.columns.length; index++) {
648
+ result += `<th>${data.columns[index]}</th>`;
649
+ }
650
+ result += "</tr>";
651
+ result += "</thead>";
652
+ return result;
653
+ }
654
+ static BuildBody(rows) {
655
+ let result = "<tbody>";
656
+ for (let i = 0; i < rows.length; i++) {
657
+ const row = rows[i];
658
+ result += "<tr>";
659
+ for (let j = 0; j < row.columns.length; j++) {
660
+ const col = row.columns[j];
661
+ result += `<td class="align-middle">${this.BuildInnerTags(col.data.children)}</td>`;
662
+ }
663
+ result += "</tr>";
664
+ }
665
+ result += "</tbody>";
666
+ return result;
667
+ }
668
+ static BuildInnerTags(tags) {
669
+ let result = "";
670
+ for (let i = 0; i < tags.length; i++) {
671
+ result += this.BuildInnerTag(tags[i]);
672
+ }
673
+ return result;
674
+ }
675
+ static BuildInnerTag(data) {
676
+ if (data.type === FileImageTagDataConsts.TagName) {
677
+ let fileImageTag = data;
678
+ return `<img src=${fileImageTag.data.src} class="mx-auto d-block img-fluid" />`;
679
+ }
680
+ else if (data.type === TextTag) {
681
+ let simpleTextTag = data;
682
+ var map = {
683
+ ["left"]: "text-start",
684
+ ["center"]: "text-center",
685
+ ["right"]: "text-end"
686
+ };
687
+ if (!simpleTextTag.data.validationResult.isSucceeded) {
688
+ return `<span>Ошибка в тексте ${simpleTextTag.data.validationResult.message}</span>`;
689
+ }
690
+ return `<div class="${map[simpleTextTag.data.horizontalAlignment]}"><span>${simpleTextTag.data.html}</span></div>`;
691
+ }
692
+ else {
693
+ return `<p>Тег ${data.type} не поддерживается</p>`;
694
+ }
695
+ }
696
+ }
697
+
698
+ class TableTypes {
699
+ }
700
+ TableTypes.TableRowColumnData = "table-row-column-data";
701
+ TableTypes.Table = "table";
702
+ TableTypes.TableRowColumn = "table-row-column";
703
+ class TableMethods {
704
+ static getTableFromHtmlTag(tableTag) {
705
+ let tableData = {
706
+ header: TableMethods.getHeader(tableTag),
707
+ rows: TableMethods.getTableRows(tableTag)
708
+ };
709
+ var result = {
710
+ type: TableTypes.Table,
711
+ data: tableData,
712
+ validationResult: this.checkTable(tableData),
713
+ bootstrapHtml: ""
714
+ };
715
+ if (!result.validationResult) {
716
+ return result;
717
+ }
718
+ result.bootstrapHtml = BootstrapTableMethods.BuildTable(result.data);
719
+ var angularMaterialTableDataCheck = AngularMaterialTableMethods.checkAngularMaterialTableData(tableData);
720
+ if (!angularMaterialTableDataCheck.isSucceeded) {
721
+ return Object.assign(Object.assign({}, result), { angularMaterialTableDataCheck });
722
+ }
723
+ return Object.assign(Object.assign({}, result), { angularMaterialTableDataCheck, html: tableTag.outerHTML, angularMaterialTableData: AngularMaterialTableMethods.getAngularMaterialTableData(tableData.header.columns, tableData.rows) });
724
+ }
725
+ static checkTable(tableData) {
726
+ let rows = tableData.rows;
727
+ let prevRowCount = -1;
728
+ for (let i = 0; i < rows.length; i++) {
729
+ const row = rows[i];
730
+ if (row.columns.length !== prevRowCount && prevRowCount != -1) {
731
+ return {
732
+ isSucceeded: false,
733
+ message: `Ошибка при обработке разметки таблицы. `
734
+ + `Количество колонок в каждой строке таблицы должно соотвествовать друг другу. `
735
+ + `В строке таблицы №${i + 1} количество колонок = ${row.columns.length}, а в строке выше ${prevRowCount}.`
736
+ };
737
+ }
738
+ prevRowCount = row.columns.length;
739
+ }
740
+ return {
741
+ isSucceeded: true,
742
+ message: "Ok"
743
+ };
744
+ }
745
+ static getHeader(tableTag) {
746
+ let header = tableTag.tHead;
747
+ if (header === null) {
748
+ return null;
749
+ }
750
+ let tr = header.children.item(0);
751
+ let headerColumns = [];
752
+ for (let j = 0; j < tr.children.length; j++) {
753
+ const jElement = tr.children.item(j);
754
+ headerColumns.push(jElement.innerHTML);
755
+ }
756
+ return {
757
+ type: "table-header",
758
+ columns: headerColumns
759
+ };
760
+ }
761
+ static getTableRows(tableTag) {
762
+ let tBody = tableTag.tBodies.item(0);
763
+ let rows = [];
764
+ for (let i = 0; i < tBody.children.length; i++) {
765
+ const iElement = tBody.children.item(i);
766
+ let rowColumns = [];
767
+ for (let j = 0; j < iElement.children.length; j++) {
768
+ const jElement = iElement.children.item(j);
769
+ let children = HtmlExtractionMethods.transformHtmlElementToBlocks(jElement);
770
+ if (children.length === 0) {
771
+ var textTag = document.createElement("p");
772
+ textTag.innerHTML = jElement.innerHTML;
773
+ var textElem = TextSimpleMethods.ExtractTextTag(textTag);
774
+ children.push(textElem);
775
+ }
776
+ var result = {
777
+ type: TableTypes.TableRowColumnData,
778
+ data: {
779
+ text: jElement.innerHTML,
780
+ children
781
+ }
782
+ };
783
+ rowColumns.push(result);
784
+ }
785
+ rows.push({
786
+ type: TableTypes.TableRowColumn,
787
+ columns: rowColumns
788
+ });
789
+ }
790
+ return rows;
791
+ }
792
+ }
793
+
794
+ class TextMethods {
795
+ static ExtractRichTextData(elem) {
796
+ let children = [];
797
+ for (let i = 0; i < elem.children.length; i++) {
798
+ const child = elem.children.item(i);
799
+ if (child.tagName === "text-block".toUpperCase()) {
800
+ children.push({
801
+ type: "text-block",
802
+ data: {
803
+ text: child.innerHTML
804
+ }
805
+ });
806
+ }
807
+ else if (child.tagName === "line-break".toUpperCase()) {
808
+ children.push({
809
+ type: "line-break"
810
+ });
811
+ }
812
+ }
813
+ return {
814
+ type: "rich-text",
815
+ data: {
816
+ children
817
+ }
818
+ };
819
+ }
820
+ }
821
+ TextMethods.textTags = ["text", "h1", "h2", "h3", "h4", "h5", "h6"];
822
+
823
+ class HtmlExtractionMethods {
824
+ static ExtractHeaderTag(elem, tagName) {
825
+ var data = TextSimpleMethods.ExtractTextTag(elem);
826
+ data.type = tagName;
827
+ return data;
828
+ }
829
+ static transformHtmlElementToBlocks(element) {
830
+ var data = [];
831
+ for (let i = 0; i < element.children.length; i++) {
832
+ var elem = element.children.item(i);
833
+ if (!HtmlExtractionMethods.Extractors.hasOwnProperty(elem.tagName)) {
834
+ data.push({
835
+ type: "unsupported-tag",
836
+ data: {
837
+ tagString: elem.outerHTML
838
+ }
839
+ });
840
+ }
841
+ else {
842
+ var extractor = HtmlExtractionMethods.Extractors[elem.tagName];
843
+ var result = extractor(elem);
844
+ data.push(result);
845
+ }
846
+ }
847
+ return data;
848
+ }
849
+ static transformHtmlStringToBlocks(value) {
850
+ if (value === undefined) {
851
+ return [];
852
+ }
853
+ value = value
854
+ .replace('\n', '')
855
+ .replace('\t', '');
856
+ var div = document.createElement("div");
857
+ div.innerHTML = value;
858
+ return this.transformHtmlElementToBlocks(div);
859
+ }
860
+ }
861
+ HtmlExtractionMethods.Extractors = {
862
+ ["TEXT"]: (elem) => TextSimpleMethods.ExtractTextTag(elem),
863
+ ["FILE-IMAGE"]: (elem) => ImageMethods.ExtractImage(elem),
864
+ ["TABLE"]: (elem) => TableMethods.getTableFromHtmlTag(elem),
865
+ ["RICH-TEXT"]: (elem) => TextMethods.ExtractRichTextData(elem),
866
+ ["HTML-RAW"]: (elem) => ({
867
+ type: "html-raw",
868
+ data: {
869
+ innerHTML: elem.innerHTML
870
+ }
871
+ }),
872
+ ["H1"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h1"),
873
+ ["H2"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h2"),
874
+ ["H3"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h3"),
875
+ ["H4"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h4"),
876
+ ["H5"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h5"),
877
+ ["H6"]: (elem) => HtmlExtractionMethods.ExtractHeaderTag(elem, "h6"),
878
+ [ExternalVideoTagDataConsts.TagName.toUpperCase()]: (elem) => VideoMethods.ExtractExternalVideoTag(elem)
879
+ };
880
+
881
+ class HtmlRawTagDataConsts {
882
+ }
883
+ HtmlRawTagDataConsts.TagName = "html-raw";
884
+
885
+ class BodyTagsExtensions {
886
+ static getDescription(tagName) {
887
+ var descriptions = {
888
+ "text": "Текст",
889
+ "h1": "Заголовок 1 уровня",
890
+ "h2": "Заголовок 2 уровня",
891
+ "h3": "Заголовок 3 уровня",
892
+ "h4": "Заголовок 4 уровня",
893
+ "h5": "Заголовок 5 уровня",
894
+ "h6": "Заголовок 6 уровня",
895
+ [FileImageTagDataConsts.TagName]: "Изображение",
896
+ [ExternalVideoTagDataConsts.TagName]: "Внешнее видео YouTube",
897
+ [HtmlRawTagDataConsts.TagName]: "Html разметка"
898
+ };
899
+ return descriptions[tagName];
900
+ }
901
+ static toHtml(bodyTags) {
902
+ let htmls = bodyTags.map(x => {
903
+ if (TextMethods.textTags.includes(x.tagDescription.tag)) {
904
+ return `<${x.tagDescription.tag} h-align="${x.attributes['h-align']}">${x.innerHtml}</${x.tagDescription.tag}>`;
905
+ }
906
+ if (x.tagDescription.tag === ExternalVideoTagDataConsts.TagName) {
907
+ return `<${x.tagDescription.tag} type="${x.attributes['type']}" link="${x.attributes['link']}">${x.innerHtml}</${x.tagDescription.tag}>`;
908
+ }
909
+ if (x.tagDescription.tag === "html-raw") {
910
+ return `<${x.tagDescription.tag}>${x.innerHtml}</${x.tagDescription.tag}>`;
911
+ }
912
+ return BodyTagsExtensions.imageTagToHtml(x);
913
+ });
914
+ let result = "";
915
+ for (let index = 0; index < htmls.length; index++) {
916
+ const element = htmls[index];
917
+ result += element;
918
+ }
919
+ return result;
920
+ }
921
+ static imageTagToHtml(imageTag) {
922
+ var attrStr = "";
923
+ var attrValue = imageTag.attributes[FileImageTagDataConsts.FileIdAttrName];
924
+ if (imageTag.attributes.hasOwnProperty(FileImageTagDataConsts.FileIdAttrName) && attrValue) {
925
+ attrStr = `${FileImageTagDataConsts.FileIdAttrName}="${attrValue}"`;
926
+ }
927
+ return `<${FileImageTagDataConsts.TagName} ${attrStr}></${FileImageTagDataConsts.TagName}>`;
928
+ }
929
+ static getBodyTags(html) {
930
+ let result = HtmlExtractionMethods.transformHtmlStringToBlocks(html);
931
+ return result.map(x => BodyTagsExtensions.toBodyTag(x));
932
+ }
933
+ static sanitizeInnerHtml(html) {
934
+ return html.trim().replace('\n\t', '');
935
+ }
936
+ static toBodyTag(data) {
937
+ if (TextMethods.textTags.includes(data.type)) {
938
+ let textTagData = data.data;
939
+ return {
940
+ presentOrEdit: true,
941
+ tagDescription: {
942
+ tag: textTagData.textTagName,
943
+ displayValue: BodyTagsExtensions.getDescription(data.type)
944
+ },
945
+ attributes: { "h-align": textTagData.horizontalAlignment },
946
+ innerHtml: BodyTagsExtensions.sanitizeInnerHtml(textTagData.html)
947
+ };
948
+ }
949
+ if (data.type === FileImageTagDataConsts.TagName) {
950
+ let fileData = data.data;
951
+ let atts = {};
952
+ if (fileData.fileId) {
953
+ atts[FileImageTagDataConsts.FileIdAttrName] = fileData.fileId;
954
+ }
955
+ return {
956
+ presentOrEdit: true,
957
+ tagDescription: {
958
+ tag: FileImageTagDataConsts.TagName,
959
+ displayValue: BodyTagsExtensions.getDescription(data.type)
960
+ },
961
+ attributes: atts,
962
+ innerHtml: ""
963
+ };
964
+ }
965
+ if (data.type === ExternalVideoTagDataConsts.TagName) {
966
+ let fileData = data.data;
967
+ return {
968
+ presentOrEdit: true,
969
+ tagDescription: {
970
+ tag: ExternalVideoTagDataConsts.TagName,
971
+ displayValue: BodyTagsExtensions.getDescription(data.type)
972
+ },
973
+ attributes: fileData,
974
+ innerHtml: ""
975
+ };
976
+ }
977
+ if (data.type === HtmlRawTagDataConsts.TagName) {
978
+ return {
979
+ presentOrEdit: true,
980
+ tagDescription: {
981
+ tag: HtmlRawTagDataConsts.TagName,
982
+ displayValue: BodyTagsExtensions.getDescription(data.type)
983
+ },
984
+ attributes: {},
985
+ innerHtml: BodyTagsExtensions.sanitizeInnerHtml(data.data["innerHTML"])
986
+ };
987
+ }
988
+ return {
989
+ presentOrEdit: true,
990
+ tagDescription: {
991
+ tag: "unsupported-tag",
992
+ displayValue: "Неподдерживаемый тег"
993
+ },
994
+ attributes: {},
995
+ innerHtml: JSON.stringify(data)
996
+ };
997
+ }
998
+ }
999
+
1000
+ class XmlExtensions {
1001
+ static formatXml(xml, tab = '\t') {
1002
+ var formatted = '', indent = '';
1003
+ tab = tab || '\t';
1004
+ xml.split(/>\s*</).forEach(function (node) {
1005
+ if (node.match(/^\/\w/))
1006
+ indent = indent.substring(tab.length); // decrease indent by one 'tab'
1007
+ formatted += indent + '<' + node + '>\r\n';
1008
+ if (node.match(/^<?\w[^>]*[^\/]$/))
1009
+ indent += tab; // increase indent
1010
+ });
1011
+ return formatted.substring(1, formatted.length - 3);
1012
+ }
1013
+ static tagsToLower(xml) {
1014
+ xml = this.replaceTagToLower(xml, "Body");
1015
+ xml = this.replaceTagToLower(xml, "Image");
1016
+ xml = this.replaceTagToLower(xml, "Text");
1017
+ return xml;
1018
+ }
1019
+ static replaceTagToLower(xml, tag) {
1020
+ return xml
1021
+ .replace(new RegExp(`<${tag}`, 'g'), `<${tag.toLowerCase()}`)
1022
+ .replace(new RegExp(`</${tag}>`, 'g'), `</${tag.toLowerCase()}>`);
1023
+ }
1024
+ }
1025
+
1026
+ class TextEditorComponent {
1027
+ constructor() {
1028
+ this.myForm = new FormGroup({
1029
+ "innerHtml": new FormControl()
1030
+ });
1031
+ this.onTagUpdated = new EventEmitter();
1032
+ }
1033
+ ngOnInit() {
1034
+ }
1035
+ getInnerHtml() {
1036
+ return `<${this.tag.tagDescription.tag}>${this.tag.innerHtml}<${this.tag.tagDescription.tag}/>`;
1037
+ }
1038
+ }
1039
+ TextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: TextEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1040
+ TextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: TextEditorComponent, selector: "croco-html-text-editor", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, ngImport: i0, template: "<div *ngIf=\"tag.presentOrEdit\">\n <div style=\"height: 10px;\">\n </div>\n\n <div style=\"text-align: left;\" *ngIf=\"tag.attributes['h-align'] === 'left'\" [innerHtml]=\"getInnerHtml()\">\n </div>\n <div style=\"text-align: right;\" *ngIf=\"tag.attributes['h-align'] === 'right'\" [innerHtml]=\"getInnerHtml()\">\n </div>\n <div style=\"text-align: center;\" *ngIf=\"tag.attributes['h-align'] === 'center'\" [innerHtml]=\"getInnerHtml()\">\n </div>\n</div>\n\n<div *ngIf=\"!tag.presentOrEdit\">\n <div style=\"overflow-x: auto;\">\n <mat-button-toggle-group [(ngModel)]=\"tag.attributes['h-align']\">\n <mat-button-toggle value=\"center\">\n \u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443 <mat-icon>format_align_center</mat-icon>\n </mat-button-toggle>\n <mat-button-toggle value=\"left\">\n \u0421\u043B\u0435\u0432\u0430 <mat-icon>format_align_left</mat-icon>\n </mat-button-toggle>\n <mat-button-toggle value=\"right\">\n \u0421\u043F\u0440\u0430\u0432\u0430 <mat-icon> format_align_right</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n </div>\n\n <div style=\"height: 10px;\">\n </div>\n <form [formGroup]=\"myForm\">\n <mat-form-field class=\"w-100\">\n <textarea matInput cdkTextareaAutosize #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n placeholder=\"\u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u043E\u0433\u043E \u0442\u0435\u0433\u0430\"\n formControlName=\"innerHtml\"\n [(ngModel)]=\"tag.innerHtml\"></textarea>\n </mat-form-field>\n </form>\n</div>", styles: [""], components: [{ type: i1$2.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$2.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }] });
1041
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: TextEditorComponent, decorators: [{
1042
+ type: Component,
1043
+ args: [{
1044
+ selector: 'croco-html-text-editor',
1045
+ templateUrl: './text-editor.component.html',
1046
+ styleUrls: ['./text-editor.component.css']
1047
+ }]
1048
+ }], ctorParameters: function () { return []; }, propDecorators: { tag: [{
1049
+ type: Input
1050
+ }], onTagUpdated: [{
1051
+ type: Output
1052
+ }] } });
1053
+
1054
+ class MainEditorBlockComponent {
1055
+ constructor() {
1056
+ this.textTags = TextMethods.textTags;
1057
+ this.onTagSaved = new EventEmitter();
1058
+ this.onTagRemoved = new EventEmitter();
1059
+ }
1060
+ tagUpdatedHandler(tag) {
1061
+ }
1062
+ save() {
1063
+ this.tag.presentOrEdit = true;
1064
+ this.onTagSaved.emit(this.tag);
1065
+ }
1066
+ deleteItem() {
1067
+ this.onTagRemoved.emit(this.tag);
1068
+ }
1069
+ ngOnInit() {
1070
+ }
1071
+ }
1072
+ MainEditorBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: MainEditorBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1073
+ MainEditorBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: MainEditorBlockComponent, selector: "croco-html-main-editor-block", inputs: { tag: "tag" }, outputs: { onTagSaved: "onTagSaved", onTagRemoved: "onTagRemoved" }, ngImport: i0, template: "<div>\n <div>\n <div *ngIf=\"textTags.includes(tag.tagDescription.tag)\">\n <croco-html-text-editor (onTagUpdated)=\"tagUpdatedHandler($event)\" [tag]=\"tag\">\n </croco-html-text-editor>\n </div>\n\n <div *ngIf=\"tag.tagDescription.tag === 'file-image'\"> \n <croco-html-image-editor (onTagUpdated)=\"tagUpdatedHandler($event)\" [tag]=\"tag\">\n </croco-html-image-editor>\n </div>\n\n <div *ngIf=\"tag.tagDescription.tag === 'external-video'\">\n <croco-html-external-video-block (onTagUpdated)=\"tagUpdatedHandler($event)\" [tag]=\"tag\">\n </croco-html-external-video-block>\n </div>\n\n <div *ngIf=\"tag.tagDescription.tag === 'html-raw'\">\n <croco-html-html-raw-editor (onTagUpdated)=\"tagUpdatedHandler($event)\" [tag]=\"tag\">\n </croco-html-html-raw-editor>\n </div>\n\n </div>\n\n <div class=\"d-flex justify-content-between\">\n <div class=\"d-flex justify-content-end align-self-center\">\n <div>\n <button *ngIf=\"tag.presentOrEdit\" (click)=\"tag.presentOrEdit = false\" mat-icon-button>\n <mat-icon>edit</mat-icon>\n </button>\n <button *ngIf=\"!tag.presentOrEdit\" (click)=\"save()\" mat-icon-button>\n <mat-icon>save</mat-icon>\n </button>\n <button (click)=\"deleteItem()\" mat-icon-button color=\"warn\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n </div>\n\n </div>\n</div>", styles: [""], components: [{ type: TextEditorComponent, selector: "croco-html-text-editor", inputs: ["tag"], outputs: ["onTagUpdated"] }, { type: ImageEditorComponent, selector: "croco-html-image-editor", inputs: ["tag"], outputs: ["onTagUpdated"] }, { type: ExternalVideoBlockComponent, selector: "croco-html-external-video-block", inputs: ["tag"], outputs: ["onTagUpdated"] }, { type: HtmlRawEditorComponent, selector: "croco-html-html-raw-editor", inputs: ["tag"], outputs: ["onTagUpdated"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: MainEditorBlockComponent, decorators: [{
1075
+ type: Component,
1076
+ args: [{
1077
+ selector: 'croco-html-main-editor-block',
1078
+ templateUrl: './main-editor-block.component.html',
1079
+ styleUrls: ['./main-editor-block.component.css']
1080
+ }]
1081
+ }], ctorParameters: function () { return []; }, propDecorators: { tag: [{
1082
+ type: Input
1083
+ }], onTagSaved: [{
1084
+ type: Output
1085
+ }], onTagRemoved: [{
1086
+ type: Output
1087
+ }] } });
1088
+
1089
+ class DefaultTags {
1090
+ static getTags(useHtmlRaw) {
1091
+ var result = [...DefaultTags.tags];
1092
+ if (useHtmlRaw) {
1093
+ result.push(DefaultTags.htmlRawTag);
1094
+ }
1095
+ return result;
1096
+ }
1097
+ }
1098
+ DefaultTags.tags = [
1099
+ { tag: FileImageTagDataConsts.TagName, displayValue: 'Изображение' },
1100
+ { tag: ExternalVideoTagDataConsts.TagName, displayValue: 'Внешнее видео Youtube' },
1101
+ { tag: 'text', displayValue: 'Текст' },
1102
+ { tag: 'h1', displayValue: 'Заголовок 1 уровня' },
1103
+ { tag: 'h2', displayValue: 'Заголовок 2 уровня' },
1104
+ { tag: 'h3', displayValue: 'Заголовок 3 уровня' },
1105
+ { tag: 'h4', displayValue: 'Заголовок 4 уровня' },
1106
+ { tag: 'h5', displayValue: 'Заголовок 5 уровня' },
1107
+ { tag: 'h6', displayValue: 'Заголовок 6 уровня' },
1108
+ ];
1109
+ DefaultTags.htmlRawTag = {
1110
+ tag: HtmlRawTagDataConsts.TagName, displayValue: 'Html разметка'
1111
+ };
1112
+ class VisualEditorComponent {
1113
+ constructor(_cdref) {
1114
+ this._cdref = _cdref;
1115
+ this.isLoading = false;
1116
+ this.loadingText = "Идёт загрузка";
1117
+ this.showMarkUp = true;
1118
+ this.myForm = new FormGroup({
1119
+ "html": new FormControl(),
1120
+ });
1121
+ this.tags = [];
1122
+ this.useHtmlRaw = false;
1123
+ this.html = "";
1124
+ this.onHtmlChanged = new EventEmitter();
1125
+ this.rendered = new EventEmitter();
1126
+ this.bodyTags = [];
1127
+ }
1128
+ isHtmlSet() {
1129
+ return this.html.startsWith("<body>");
1130
+ }
1131
+ clearHtml() {
1132
+ this.html = "";
1133
+ this.recalculateBodyTags();
1134
+ }
1135
+ getHtml() {
1136
+ this.recalculateHtml();
1137
+ return this.html;
1138
+ }
1139
+ ngAfterViewInit() {
1140
+ this.rendered.emit(true);
1141
+ }
1142
+ ngAfterContentChecked() {
1143
+ this._cdref.detectChanges();
1144
+ }
1145
+ addTag() {
1146
+ let tagDescription = this.tags
1147
+ .find(x => x.tag === this.selectedValue);
1148
+ let attrs = {};
1149
+ let innerHtml = "";
1150
+ if (TextMethods.textTags.includes(tagDescription.tag)) {
1151
+ attrs["h-align"] = "left";
1152
+ innerHtml = "Введите ваш текст";
1153
+ }
1154
+ else if (tagDescription.tag == ExternalVideoTagDataConsts.TagName) {
1155
+ attrs[ExternalVideoTagDataConsts.VideoTypeAttrName] = ExternalVideoSupportedTypes.Youtube;
1156
+ attrs[ExternalVideoTagDataConsts.LinkAttrName] = null;
1157
+ }
1158
+ else {
1159
+ attrs[FileImageTagDataConsts.FileIdAttrName] = null;
1160
+ }
1161
+ this.bodyTags.push({
1162
+ tagDescription,
1163
+ innerHtml,
1164
+ attributes: attrs,
1165
+ presentOrEdit: true
1166
+ });
1167
+ this.recalculateHtml();
1168
+ }
1169
+ postFilesStartedEventHandler(model) {
1170
+ this.loadingText = "Файлы загружаются на сервер";
1171
+ this.isLoading = true;
1172
+ }
1173
+ addTagCustom(tag) {
1174
+ this.bodyTags.push(tag);
1175
+ this.recalculateHtml();
1176
+ }
1177
+ filesTagsReadyHandler(tags) {
1178
+ for (let i = 0; i < tags.length; i++) {
1179
+ this.bodyTags.push(tags[i]);
1180
+ }
1181
+ this.recalculateHtml();
1182
+ this.isLoading = false;
1183
+ }
1184
+ drop(event) {
1185
+ moveItemInArray(this.bodyTags, event.previousIndex, event.currentIndex);
1186
+ this.recalculateHtml();
1187
+ }
1188
+ onTagSavedHandler(tag) {
1189
+ this.recalculateHtml();
1190
+ }
1191
+ onTagRemovedHandler(index) {
1192
+ this.bodyTags.splice(index, 1);
1193
+ this.recalculateHtml();
1194
+ }
1195
+ recalculateHtml() {
1196
+ let result = BodyTagsExtensions.toHtml(this.bodyTags);
1197
+ this.html = XmlExtensions.formatXml("<body>" + result + "</body>");
1198
+ this.onHtmlChanged.emit(this.html);
1199
+ }
1200
+ recalculateBodyTags() {
1201
+ this.bodyTags = BodyTagsExtensions.getBodyTags(this.html);
1202
+ }
1203
+ ngOnInit() {
1204
+ this.recalculateBodyTags();
1205
+ this.tags = DefaultTags.getTags(this.useHtmlRaw);
1206
+ this.selectedValue = this.tags[0].tag;
1207
+ }
1208
+ }
1209
+ VisualEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: VisualEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1210
+ VisualEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: VisualEditorComponent, selector: "croco-visual-editor", inputs: { showMarkUp: "showMarkUp", useHtmlRaw: "useHtmlRaw", html: "html" }, outputs: { html: "html", onHtmlChanged: "onHtmlChanged", rendered: "rendered" }, ngImport: i0, template: "<div *ngIf=\"isLoading\">\n <div>\n <mat-spinner style=\"margin:0 auto;\"></mat-spinner>\n <div style=\"text-align: center;\">{{loadingText}}</div>\n </div>\n <div style=\"height: 10px;\"></div>\n</div>\n\n<div [hidden]=\"isLoading\">\n <div cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <div *ngFor=\"let tag of bodyTags; let i = index\" cdkDrag>\n <mat-card>\n <div class=\"d-flex justify-content-between\">\n <div class=\"example-handle\" cdkDragHandle>\n <svg width=\"24px\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n d=\"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z\">\n </path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n </div>\n <div>\n <mat-chip-list aria-label=\"Tag display value\">\n <mat-chip color=\"primary\" selected>{{tag.tagDescription.displayValue}}</mat-chip>\n </mat-chip-list>\n </div>\n </div>\n \n <div style=\"height: 15px;\"></div>\n \n <croco-html-main-editor-block [tag]=\"tag\" \n (onTagSaved)=\"onTagSavedHandler($event)\"\n (onTagRemoved)=\"onTagRemovedHandler(i)\">\n </croco-html-main-editor-block>\n </mat-card>\n \n <div style=\"height: 10px;\">\n </div>\n </div>\n </div>\n</div>\n\n\n<div [hidden]=\"isLoading\">\n <mat-card>\n <div class=\"row d-flex align-items-center\">\n <div class=\"col-12\">\n <mat-form-field class=\"w-100\" appearance=\"fill\">\n <mat-label>\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u0433</mat-label>\n <mat-select [(ngModel)]=\"selectedValue\">\n <mat-option *ngFor=\"let tag of tags\" [value]=\"tag.tag\">\n {{tag.displayValue}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col-12\">\n <button (click)=\"addTag()\" class=\"w-100\" mat-stroked-button>\n \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0442\u0435\u0433\n </button>\n </div>\n </div>\n </mat-card>\n\n <div style=\"height: 10px;\">\n </div>\n</div>\n\n<div [hidden]=\"isLoading\">\n <mat-card>\n <div class=\"row d-flex align-items-center\">\n <div class=\"col-12\">\n <croco-add-files-btn \n (filesTagsReady)=\"filesTagsReadyHandler($event)\"\n (postFilesStarted)=\"postFilesStartedEventHandler($event)\"\n class=\"w-100\">\n </croco-add-files-btn>\n </div>\n </div>\n </mat-card>\n\n <div style=\"height: 10px;\">\n </div>\n</div>", styles: [".example-list{width:500px;max-width:100%;border:solid 1px #ccc;min-height:60px;display:block;background:white;border-radius:4px;overflow:hidden}.example-box{padding:20px 10px;border-bottom:solid 1px #ccc;color:#000000de;display:flex;flex-direction:row;align-items:center;justify-content:space-between;box-sizing:border-box;cursor:move;background:white;font-size:14px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.example-box:last-child{border:none}.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], components: [{ type: i1$3.MatSpinner, selector: "mat-spinner", inputs: ["color"] }, { type: i2$3.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i3$1.MatChipList, selector: "mat-chip-list", inputs: ["aria-orientation", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "selectable", "tabIndex", "errorStateMatcher"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: MainEditorBlockComponent, selector: "croco-html-main-editor-block", inputs: ["tag"], outputs: ["onTagSaved", "onTagRemoved"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: AddFilesBtnComponent, selector: "croco-add-files-btn", outputs: ["postFilesStarted", "filesTagsReady"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i11.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i3$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i5.MatLabel, selector: "mat-label" }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
1211
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: VisualEditorComponent, decorators: [{
1212
+ type: Component,
1213
+ args: [{
1214
+ selector: 'croco-visual-editor',
1215
+ templateUrl: './visual-editor.component.html',
1216
+ styleUrls: ['./visual-editor.component.css']
1217
+ }]
1218
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { showMarkUp: [{
1219
+ type: Input
1220
+ }], useHtmlRaw: [{
1221
+ type: Input
1222
+ }], html: [{
1223
+ type: Input
1224
+ }, {
1225
+ type: Output
1226
+ }], onHtmlChanged: [{
1227
+ type: Output
1228
+ }], rendered: [{
1229
+ type: Output
1230
+ }] } });
1231
+
1232
+ class XmlTagTextViewComponent {
1233
+ constructor() { }
1234
+ ngOnInit() {
1235
+ }
1236
+ }
1237
+ XmlTagTextViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagTextViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1238
+ XmlTagTextViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagTextViewComponent, selector: "croco-html-xml-tag-text-view", inputs: { item: "item" }, ngImport: i0, template: "<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'left'\" style=\"text-align: left;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n <span *ngIf=\"item.data.html.length > 0\" [innerHtml]=\"item.data.html\"></span>\n</div>\n\n<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'right'\" style=\"text-align: right;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n <span *ngIf=\"item.data.html.length > 0\" [innerHtml]=\"item.data.html\"></span>\n</div>\n\n<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'center'\" style=\"text-align: center;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n <span *ngIf=\"item.data.html.length > 0\" [innerHtml]=\"item.data.html\"></span>\n</div>\n\n<div *ngIf=\"!item.data.validationResult.isSucceeded\" class=\"red\" style=\"margin-top: 10px;\" >\n <h4>\u0414\u043E\u043F\u0443\u0449\u0435\u043D\u0430 \u043E\u0448\u0438\u0431\u043A\u0430 \u0432 \u0442\u0435\u0433\u0435 &lt;text&gt;</h4>\n <span>\n {{item.data.validationResult.message}}\n </span>\n</div>", styles: [""], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagTextViewComponent, decorators: [{
1240
+ type: Component,
1241
+ args: [{
1242
+ selector: 'croco-html-xml-tag-text-view',
1243
+ templateUrl: './xml-tag-text-view.component.html',
1244
+ styleUrls: ['./xml-tag-text-view.component.css']
1245
+ }]
1246
+ }], ctorParameters: function () { return []; }, propDecorators: { item: [{
1247
+ type: Input
1248
+ }] } });
1249
+
1250
+ class XmlTagHeaderInnerTextViewComponent {
1251
+ constructor() { }
1252
+ ngOnInit() {
1253
+ }
1254
+ }
1255
+ XmlTagHeaderInnerTextViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHeaderInnerTextViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1256
+ XmlTagHeaderInnerTextViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagHeaderInnerTextViewComponent, selector: "croco-html-xml-tag-header-inner-text-view", inputs: { item: "item" }, ngImport: i0, template: "<h1 *ngIf=\"item.type === 'h1'\" \n [innerHtml]=\"item.data.html\">\n</h1>\n<h2 *ngIf=\"item.type === 'h2'\" \n [innerHtml]=\"item.data.html\">\n</h2>\n<h3 *ngIf=\"item.type === 'h3'\" \n [innerHtml]=\"item.data.html\">\n</h3>\n<h4 *ngIf=\"item.type === 'h4'\" \n [innerHtml]=\"item.data.html\">\n</h4>\n<h5 *ngIf=\"item.type === 'h5'\" \n [innerHtml]=\"item.data.html\">\n</h5>\n<h6 *ngIf=\"item.type === 'h6'\" \n [innerHtml]=\"item.data.html\">\n</h6>", styles: [""], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHeaderInnerTextViewComponent, decorators: [{
1258
+ type: Component,
1259
+ args: [{
1260
+ selector: 'croco-html-xml-tag-header-inner-text-view',
1261
+ templateUrl: './xml-tag-header-inner-text-view.component.html',
1262
+ styleUrls: ['./xml-tag-header-inner-text-view.component.css']
1263
+ }]
1264
+ }], ctorParameters: function () { return []; }, propDecorators: { item: [{
1265
+ type: Input
1266
+ }] } });
1267
+
1268
+ class XmlTagHeaderTextViewComponent {
1269
+ constructor() { }
1270
+ ngOnInit() {
1271
+ }
1272
+ }
1273
+ XmlTagHeaderTextViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHeaderTextViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1274
+ XmlTagHeaderTextViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagHeaderTextViewComponent, selector: "croco-html-xml-tag-header-text-view", inputs: { item: "item" }, ngImport: i0, template: "<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'left'\" style=\"text-align: left;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n <croco-html-xml-tag-header-inner-text-view *ngIf=\"item.data.html.length > 0\" [item]=\"item\">\n </croco-html-xml-tag-header-inner-text-view>\n</div>\n\n<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'right'\" style=\"text-align: right;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n <croco-html-xml-tag-header-inner-text-view *ngIf=\"item.data.html.length > 0\" [item]=\"item\">\n </croco-html-xml-tag-header-inner-text-view>\n</div>\n\n<div *ngIf=\"item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'center'\" style=\"text-align: center;\">\n <span *ngIf=\"item.data.html.length === 0 || !item.data.html\">&nbsp;</span>\n\n <croco-html-xml-tag-header-inner-text-view *ngIf=\"item.data.html.length > 0\" [item]=\"item\">\n </croco-html-xml-tag-header-inner-text-view>\n</div>\n\n<div *ngIf=\"!item.data.validationResult.isSucceeded\" class=\"red\" style=\"margin-top: 10px;\" >\n <h4>\u0414\u043E\u043F\u0443\u0449\u0435\u043D\u0430 \u043E\u0448\u0438\u0431\u043A\u0430 \u0432 \u0442\u0435\u0433\u0435 &lt;text&gt;</h4>\n <span>\n {{item.data.validationResult.message}}\n </span>\n</div>", styles: [""], components: [{ type: XmlTagHeaderInnerTextViewComponent, selector: "croco-html-xml-tag-header-inner-text-view", inputs: ["item"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHeaderTextViewComponent, decorators: [{
1276
+ type: Component,
1277
+ args: [{
1278
+ selector: 'croco-html-xml-tag-header-text-view',
1279
+ templateUrl: './xml-tag-header-text-view.component.html',
1280
+ styleUrls: ['./xml-tag-header-text-view.component.css']
1281
+ }]
1282
+ }], ctorParameters: function () { return []; }, propDecorators: { item: [{
1283
+ type: Input
1284
+ }] } });
1285
+
1286
+ class XmlTagHtmlViewComponent {
1287
+ constructor() {
1288
+ this.html = "";
1289
+ }
1290
+ }
1291
+ XmlTagHtmlViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHtmlViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1292
+ XmlTagHtmlViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagHtmlViewComponent, selector: "croco-html-xml-tag-html-view", inputs: { html: "html" }, ngImport: i0, template: "<div class=\"col\" [innerHTML]=\"html\">\n \n</div>", styles: [""] });
1293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagHtmlViewComponent, decorators: [{
1294
+ type: Component,
1295
+ args: [{
1296
+ selector: 'croco-html-xml-tag-html-view',
1297
+ templateUrl: './xml-tag-html-view.component.html',
1298
+ styleUrls: ['./xml-tag-html-view.component.css']
1299
+ }]
1300
+ }], ctorParameters: function () { return []; }, propDecorators: { html: [{
1301
+ type: Input
1302
+ }] } });
1303
+
1304
+ class XmlTagViewComponent {
1305
+ constructor() {
1306
+ this.data = [];
1307
+ }
1308
+ }
1309
+ XmlTagViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1310
+ XmlTagViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagViewComponent, selector: "croco-html-xml-tag-view", inputs: { data: "data" }, ngImport: i0, template: "<div class=\"\">\n <div class=\"row\" *ngFor=\"let item of data\">\n <div *ngIf=\"item.type === 'text'\">\n <croco-html-xml-tag-text-view [item]=\"item\"></croco-html-xml-tag-text-view>\n </div>\n <div *ngIf=\"item.type === 'image'\" class=\"red\" style=\"margin-top: 10px;\" >\n <h4>\u0414\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u0433 \u0431\u043E\u043B\u044C\u0448\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F</h4>\n <span>\n \u0412\u043C\u0435\u0442\u043E \u044D\u0442\u043E\u0433\u043E \u043F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u0443\u0439\u0442\u0435 \u0442\u0435\u0433 image \u043D\u0430 file-image\n </span>\n </div>\n <div *ngIf=\"item.type === 'html-raw'\" [innerHTML]=\"item.data.innerHTML\">\n </div>\n <div *ngIf=\"item.type === 'h1' || item.type === 'h2' || item.type === 'h3' || item.type === 'h4' || item.type === 'h5' || item.type === 'h6'\">\n <croco-html-xml-tag-header-text-view [item]=\"item\"></croco-html-xml-tag-header-text-view>\n </div>\n <div *ngIf=\"item.type === 'file-image'\">\n <img class=\"mx-auto d-block img-fluid\" [src]=\"item.data.src\"/>\n </div>\n <div *ngIf=\"item.type === 'table'\">\n \n <croco-html-xml-tag-html-view *ngIf=\"item.validationResult.isSucceeded\" [html]=\"item.bootstrapHtml\">\n </croco-html-xml-tag-html-view>\n \n <app-tutor-baseapiresponse-banner \n *ngIf=\"item.validationResult && !item.validationResult.isSucceeded\" \n [message]=\"item.validationResult.message\">\n </app-tutor-baseapiresponse-banner>\n </div>\n \n <div *ngIf=\"item.type === 'rich-text'\">\n <croco-html-xml-tag-text-view [richTextData]=\"item\"></croco-html-xml-tag-text-view>\n </div>\n <div *ngIf=\"item.type === 'external-video'\">\n <croco-html-xml-tag-external-video [data]=\"item\"></croco-html-xml-tag-external-video>\n </div>\n <div *ngIf=\"item.type === 'unsupported-tag'\" class=\"red\" style=\"margin-top: 10px;\" >\n <h4>\u0414\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u0433 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F</h4>\n <span>\n {{item.data.tagString}}\n </span>\n </div>\n </div>\n</div>", styles: [".red{background-color:#c94444;color:#fff}\n"], components: [{ type: XmlTagTextViewComponent, selector: "croco-html-xml-tag-text-view", inputs: ["item"] }, { type: XmlTagHeaderTextViewComponent, selector: "croco-html-xml-tag-header-text-view", inputs: ["item"] }, { type: XmlTagHtmlViewComponent, selector: "croco-html-xml-tag-html-view", inputs: ["html"] }, { type: XmlTagExternalVideoComponent, selector: "croco-html-xml-tag-external-video", inputs: ["data", "tagData"] }], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
1311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagViewComponent, decorators: [{
1312
+ type: Component,
1313
+ args: [{
1314
+ selector: 'croco-html-xml-tag-view',
1315
+ templateUrl: './xml-tag-view.component.html',
1316
+ styleUrls: ['./xml-tag-view.component.css'],
1317
+ encapsulation: ViewEncapsulation.None,
1318
+ }]
1319
+ }], ctorParameters: function () { return []; }, propDecorators: { data: [{
1320
+ type: Input
1321
+ }] } });
1322
+
1323
+ class ToPreviewPipe {
1324
+ transform(value) {
1325
+ return HtmlExtractionMethods.transformHtmlStringToBlocks(value);
1326
+ }
1327
+ }
1328
+ ToPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1329
+ ToPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToPreviewPipe, name: "topreview" });
1330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToPreviewPipe, decorators: [{
1331
+ type: Pipe,
1332
+ args: [{
1333
+ name: 'topreview'
1334
+ }]
1335
+ }] });
1336
+
1337
+ class MainEditorComponent {
1338
+ constructor(_clipboardService, _snackBar, _cdref) {
1339
+ this._clipboardService = _clipboardService;
1340
+ this._snackBar = _snackBar;
1341
+ this._cdref = _cdref;
1342
+ this.visualEditorRendered = false;
1343
+ this.showMarkUp = true;
1344
+ this.useHtmlRaw = false;
1345
+ this.myForm = new FormGroup({
1346
+ "html": new FormControl(),
1347
+ });
1348
+ this.html = "";
1349
+ this.onHtmlChanged = new EventEmitter();
1350
+ }
1351
+ ngAfterContentChecked() {
1352
+ this._cdref.detectChanges();
1353
+ }
1354
+ visualEditorRenderedHandler() {
1355
+ this.visualEditorRendered = true;
1356
+ this.recalculateBodyTags();
1357
+ }
1358
+ onHtmlChangedHandler(html) {
1359
+ this.html = html;
1360
+ this.onHtmlChanged.emit(html);
1361
+ }
1362
+ textAreaModelChangedHandler() {
1363
+ this.recalculateBodyTags();
1364
+ this.onHtmlChangedHandler(this.html);
1365
+ }
1366
+ recalculateBodyTags() {
1367
+ this.visualEditor.html = this.html;
1368
+ this.visualEditor.recalculateBodyTags();
1369
+ }
1370
+ copyMarkUp() {
1371
+ this._snackBar.open("Разметка таблицы скопирована в буфер обмена", "Закрыть", { duration: 1500 });
1372
+ this._clipboardService.copy(this.html);
1373
+ }
1374
+ ngOnInit() {
1375
+ }
1376
+ }
1377
+ MainEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: MainEditorComponent, deps: [{ token: i1$4.ClipboardService }, { token: i2$4.MatSnackBar }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1378
+ MainEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: MainEditorComponent, selector: "croco-html-main-editor", inputs: { showMarkUp: "showMarkUp", useHtmlRaw: "useHtmlRaw", html: "html" }, outputs: { html: "html", onHtmlChanged: "onHtmlChanged" }, viewQueries: [{ propertyName: "visualEditor", first: true, predicate: ["visualEditor"], descendants: true }], ngImport: i0, template: "<mat-tab-group>\n <mat-tab label=\"\u0412\u0438\u0437\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\">\n\n <div style=\"height: 20px;\"></div>\n\n <croco-visual-editor #visualEditor\n [useHtmlRaw]=\"useHtmlRaw\"\n [html]=\"html\"\n (onHtmlChanged)=\"onHtmlChangedHandler($event)\"\n (rendered)=\"visualEditorRenderedHandler()\">\n </croco-visual-editor>\n\n <div style=\"height: 20px;\"></div>\n\n </mat-tab>\n\n <mat-tab label=\"\u0420\u0430\u0437\u043C\u0435\u0442\u043A\u0430\">\n <div style=\"height: 10px;\"></div>\n <form *ngIf=\"visualEditorRendered\" [formGroup]=\"myForm\">\n <mat-form-field class=\"w-100\">\n <textarea matInput cdkTextareaAutosize #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n placeholder=\"\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u043A\u043E\u0434\" formControlName=\"html\" [(ngModel)]=\"html\"\n (ngModelChange)=\"textAreaModelChangedHandler()\"></textarea>\n </mat-form-field>\n </form>\n\n <button (click)=\"copyMarkUp()\" \n mat-raised-button color=\"primary\">\n \u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0443\n </button>\n </mat-tab>\n <mat-tab label=\"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\">\n <mat-card>\n <croco-html-xml-tag-view [data]=\"html | topreview\">\n </croco-html-xml-tag-view>\n </mat-card>\n </mat-tab>\n</mat-tab-group>", styles: [".example-list{width:500px;max-width:100%;border:solid 1px #ccc;min-height:60px;display:block;background:white;border-radius:4px;overflow:hidden}.example-box{padding:20px 10px;border-bottom:solid 1px #ccc;color:#000000de;display:flex;flex-direction:row;align-items:center;justify-content:space-between;box-sizing:border-box;cursor:move;background:white;font-size:14px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.example-box:last-child{border:none}.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], components: [{ type: i3$2.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { type: i3$2.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby"], exportAs: ["matTab"] }, { type: VisualEditorComponent, selector: "croco-visual-editor", inputs: ["showMarkUp", "useHtmlRaw", "html"], outputs: ["html", "onHtmlChanged", "rendered"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$3.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: XmlTagViewComponent, selector: "croco-html-xml-tag-view", inputs: ["data"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }], pipes: { "topreview": ToPreviewPipe } });
1379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: MainEditorComponent, decorators: [{
1380
+ type: Component,
1381
+ args: [{
1382
+ selector: 'croco-html-main-editor',
1383
+ templateUrl: './main-editor.component.html',
1384
+ styleUrls: ['./main-editor.component.css']
1385
+ }]
1386
+ }], ctorParameters: function () { return [{ type: i1$4.ClipboardService }, { type: i2$4.MatSnackBar }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { visualEditor: [{
1387
+ type: ViewChild,
1388
+ args: ["visualEditor"]
1389
+ }], showMarkUp: [{
1390
+ type: Input
1391
+ }], useHtmlRaw: [{
1392
+ type: Input
1393
+ }], html: [{
1394
+ type: Input
1395
+ }, {
1396
+ type: Output
1397
+ }], onHtmlChanged: [{
1398
+ type: Output
1399
+ }] } });
1400
+
1401
+ class RichTextToHtmlPipe {
1402
+ transform(value) {
1403
+ let result = "";
1404
+ for (let i = 0; i < value.data.children.length; i++) {
1405
+ const child = value.data.children[i];
1406
+ if (child.type === "text-block") {
1407
+ result += `<span>${child.data.text}</span>`;
1408
+ }
1409
+ else if (child.type === "line-break") {
1410
+ result += "</br>";
1411
+ }
1412
+ }
1413
+ return result;
1414
+ }
1415
+ }
1416
+ RichTextToHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: RichTextToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1417
+ RichTextToHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: RichTextToHtmlPipe, name: "richTextToHtml" });
1418
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: RichTextToHtmlPipe, decorators: [{
1419
+ type: Pipe,
1420
+ args: [{
1421
+ name: 'richTextToHtml'
1422
+ }]
1423
+ }] });
1424
+
1425
+ class XmlTagRichTextViewComponent {
1426
+ constructor() {
1427
+ this.richTextData = null;
1428
+ }
1429
+ ngOnInit() {
1430
+ }
1431
+ }
1432
+ XmlTagRichTextViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagRichTextViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1433
+ XmlTagRichTextViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagRichTextViewComponent, selector: "croco-html-xml-tag-rich-text-view", inputs: { richTextData: "richTextData" }, ngImport: i0, template: "<div *ngIf=\"richTextData\" [innerHtml]=\"richTextData | richTextToHtml\">\n</div>", styles: [""], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "richTextToHtml": RichTextToHtmlPipe } });
1434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagRichTextViewComponent, decorators: [{
1435
+ type: Component,
1436
+ args: [{
1437
+ selector: 'croco-html-xml-tag-rich-text-view',
1438
+ templateUrl: './xml-tag-rich-text-view.component.html',
1439
+ styleUrls: ['./xml-tag-rich-text-view.component.css']
1440
+ }]
1441
+ }], ctorParameters: function () { return []; }, propDecorators: { richTextData: [{
1442
+ type: Input
1443
+ }] } });
1444
+
1445
+ class XmlTagTableViewComponent {
1446
+ constructor() {
1447
+ this.displayedColumns = [];
1448
+ }
1449
+ }
1450
+ XmlTagTableViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagTableViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1451
+ XmlTagTableViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: XmlTagTableViewComponent, selector: "croco-html-xml-tag-table-view", inputs: { displayedColumns: "displayedColumns", data: "data" }, ngImport: i0, template: "<table mat-table [dataSource]=\"data\" class=\"mat-elevation-z8 w-100 example-container\">\n <ng-container [matColumnDef]=\"column\" *ngFor=\"let column of displayedColumns\">\n <th mat-header-cell *matHeaderCellDef> {{column}} </th>\n <td mat-cell *matCellDef=\"let element\"> {{element[column]}} </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n</table>", styles: [""], components: [{ type: i1$5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i1$5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i1$5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$5.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i1$5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i1$5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i1$5.MatCellDef, selector: "[matCellDef]" }, { type: i1$5.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i1$5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i1$5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }] });
1452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: XmlTagTableViewComponent, decorators: [{
1453
+ type: Component,
1454
+ args: [{
1455
+ selector: 'croco-html-xml-tag-table-view',
1456
+ templateUrl: './xml-tag-table-view.component.html',
1457
+ styleUrls: ['./xml-tag-table-view.component.css']
1458
+ }]
1459
+ }], propDecorators: { displayedColumns: [{
1460
+ type: Input
1461
+ }], data: [{
1462
+ type: Input
1463
+ }] } });
1464
+
1465
+ class TagToSpanPipe {
1466
+ transform(value) {
1467
+ return value.map(x => (`<b>${x}</b>`)).join(' | ');
1468
+ }
1469
+ }
1470
+ TagToSpanPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: TagToSpanPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1471
+ TagToSpanPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: TagToSpanPipe, name: "tagToSpan" });
1472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: TagToSpanPipe, decorators: [{
1473
+ type: Pipe,
1474
+ args: [{
1475
+ name: 'tagToSpan'
1476
+ }]
1477
+ }] });
1478
+
1479
+ class ToHtmlBodyTagsPipe {
1480
+ transform(value) {
1481
+ return BodyTagsExtensions.getBodyTags(value);
1482
+ }
1483
+ }
1484
+ ToHtmlBodyTagsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToHtmlBodyTagsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1485
+ ToHtmlBodyTagsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToHtmlBodyTagsPipe, name: "tohtmlbodytags" });
1486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: ToHtmlBodyTagsPipe, decorators: [{
1487
+ type: Pipe,
1488
+ args: [{
1489
+ name: 'tohtmlbodytags'
1490
+ }]
1491
+ }] });
1492
+
1493
+ class TableBuilder {
1494
+ static getTableMarkUp(rows, cols, generateHeaders) {
1495
+ rows = +rows;
1496
+ cols = +cols;
1497
+ let result = "<table>";
1498
+ if (generateHeaders) {
1499
+ result += TableBuilder.getTableHeaderMarkUp(cols);
1500
+ }
1501
+ result += TableBuilder.getTableBodyMarkUp(cols, rows);
1502
+ result += "</table>";
1503
+ return XmlExtensions.formatXml(result);
1504
+ }
1505
+ static getTableHeaderMarkUp(cols) {
1506
+ let result = "<thead><tr>";
1507
+ for (let i = 0; i < cols; i++) {
1508
+ result += `<th>Колонка #${i + 1}</th>`;
1509
+ }
1510
+ result += "</tr></thead>";
1511
+ return result;
1512
+ }
1513
+ static getTableBodyMarkUp(cols, rows) {
1514
+ let result = "<tbody>";
1515
+ for (let row = 0; row < rows; row++) {
1516
+ result += "<tr>";
1517
+ for (let i = 0; i < cols; i++) {
1518
+ result += `<td>Ряд№${row + 1} Колонка #${i + 1}</td>`;
1519
+ }
1520
+ result += "</tr>";
1521
+ }
1522
+ result += "</tbody>";
1523
+ return result;
1524
+ }
1525
+ }
1526
+
1527
+ const EditorComponents = [
1528
+ MainEditorComponent,
1529
+ FileIdSelectComponent,
1530
+ TextEditorComponent,
1531
+ ExternalVideoBlockComponent,
1532
+ ImageEditorComponent,
1533
+ MainEditorBlockComponent,
1534
+ VisualEditorComponent,
1535
+ AddFilesBtnComponent,
1536
+ HtmlRawEditorComponent,
1537
+ ];
1538
+ const XmlComponents = [
1539
+ XmlTagTableViewComponent,
1540
+ XmlTagViewComponent,
1541
+ XmlTagRichTextViewComponent,
1542
+ XmlTagHtmlViewComponent,
1543
+ XmlTagTextViewComponent,
1544
+ XmlTagHeaderTextViewComponent,
1545
+ XmlTagHeaderInnerTextViewComponent,
1546
+ XmlTagExternalVideoComponent
1547
+ ];
1548
+ const CrocoPipes = [
1549
+ RichTextToHtmlPipe,
1550
+ TagToSpanPipe,
1551
+ ToPreviewPipe,
1552
+ ToHtmlBodyTagsPipe,
1553
+ ];
1554
+ const CrocoHtmlDeclarations = [
1555
+ UploadFilesBtnComponent,
1556
+ ...XmlComponents,
1557
+ ...EditorComponents,
1558
+ ...CrocoPipes
1559
+ ];
1560
+ const MaterialModules = [
1561
+ MatBadgeModule,
1562
+ MatTableModule,
1563
+ MatExpansionModule,
1564
+ MatFormFieldModule,
1565
+ MatSnackBarModule,
1566
+ MatProgressBarModule,
1567
+ MatProgressSpinnerModule,
1568
+ MatTabsModule,
1569
+ MatMenuModule,
1570
+ MatCardModule,
1571
+ MatSelectModule,
1572
+ MatTooltipModule,
1573
+ MatCheckboxModule,
1574
+ MatChipsModule,
1575
+ MatListModule,
1576
+ MatButtonModule,
1577
+ MatInputModule,
1578
+ MatDialogModule,
1579
+ MatPaginatorModule,
1580
+ MatDatepickerModule,
1581
+ MatGridListModule,
1582
+ MatSlideToggleModule,
1583
+ MatTreeModule,
1584
+ MatNativeDateModule,
1585
+ MatAutocompleteModule,
1586
+ MatSidenavModule,
1587
+ MatIconModule,
1588
+ DragDropModule,
1589
+ MatButtonToggleModule
1590
+ ];
1591
+
1592
+ class CrocoHtmlModule {
1593
+ }
1594
+ CrocoHtmlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: CrocoHtmlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1595
+ CrocoHtmlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: CrocoHtmlModule, declarations: [UploadFilesBtnComponent, XmlTagTableViewComponent, XmlTagViewComponent, XmlTagRichTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHeaderInnerTextViewComponent, XmlTagExternalVideoComponent, MainEditorComponent, FileIdSelectComponent, TextEditorComponent, ExternalVideoBlockComponent, ImageEditorComponent, MainEditorBlockComponent, VisualEditorComponent, AddFilesBtnComponent, HtmlRawEditorComponent, RichTextToHtmlPipe, TagToSpanPipe, ToPreviewPipe, ToHtmlBodyTagsPipe], imports: [CommonModule,
1596
+ FormsModule,
1597
+ ReactiveFormsModule,
1598
+ NgSelectModule, i23.MatBadgeModule, i1$5.MatTableModule, i25.MatExpansionModule, i5.MatFormFieldModule, i2$4.MatSnackBarModule, i28.MatProgressBarModule, i1$3.MatProgressSpinnerModule, i3$2.MatTabsModule, i31.MatMenuModule, i2$3.MatCardModule, i6.MatSelectModule, i34.MatTooltipModule, i35.MatCheckboxModule, i3$1.MatChipsModule, i37.MatListModule, i2.MatButtonModule, i5$2.MatInputModule, i40.MatDialogModule, i41.MatPaginatorModule, i42.MatDatepickerModule, i43.MatGridListModule, i44.MatSlideToggleModule, i45.MatTreeModule, i7.MatNativeDateModule, i47.MatAutocompleteModule, i48.MatSidenavModule, i2$2.MatIconModule, i11.DragDropModule, i1$2.MatButtonToggleModule], exports: [UploadFilesBtnComponent, XmlTagTableViewComponent, XmlTagViewComponent, XmlTagRichTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHeaderInnerTextViewComponent, XmlTagExternalVideoComponent, MainEditorComponent, FileIdSelectComponent, TextEditorComponent, ExternalVideoBlockComponent, ImageEditorComponent, MainEditorBlockComponent, VisualEditorComponent, AddFilesBtnComponent, HtmlRawEditorComponent, RichTextToHtmlPipe, TagToSpanPipe, ToPreviewPipe, ToHtmlBodyTagsPipe] });
1599
+ CrocoHtmlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: CrocoHtmlModule, imports: [[
1600
+ CommonModule,
1601
+ FormsModule,
1602
+ ReactiveFormsModule,
1603
+ NgSelectModule,
1604
+ ...MaterialModules
1605
+ ]] });
1606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: CrocoHtmlModule, decorators: [{
1607
+ type: NgModule,
1608
+ args: [{
1609
+ declarations: [
1610
+ ...CrocoHtmlDeclarations
1611
+ ],
1612
+ exports: [
1613
+ ...CrocoHtmlDeclarations,
1614
+ ],
1615
+ imports: [
1616
+ CommonModule,
1617
+ FormsModule,
1618
+ ReactiveFormsModule,
1619
+ NgSelectModule,
1620
+ ...MaterialModules
1621
+ ]
1622
+ }]
1623
+ }] });
1624
+
1625
+ /*
1626
+ * Public API Surface of croco-html
1627
+ */
1628
+
1629
+ /**
1630
+ * Generated bundle index. Do not edit.
1631
+ */
1632
+
1633
+ export { AddFilesBtnComponent, AngularMaterialTableMethods, BodyTagsExtensions, BootstrapTableMethods, CrocoHtmlModule, DefaultTags, ExternalVideoBlockComponent, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, FileIdSelectComponent, FileImageTagDataConsts, HtmlRawEditorComponent, ImageEditorComponent, ImageMethods, MainEditorBlockComponent, MainEditorComponent, RichTextToHtmlPipe, TableBuilder, TableMethods, TableTypes, TagToSpanPipe, TextEditorComponent, TextMethods, TextSimpleMethods, TextTag, ToHtmlBodyTagsPipe, ToPreviewPipe, UploadFilesBtnComponent, VideoMethods, VisualEditorComponent, XmlExtensions, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagRichTextViewComponent, XmlTagTableViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
1634
+ //# sourceMappingURL=croco-html.js.map