croco-html 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/croco-html.d.ts +5 -0
- package/esm2020/croco-html.mjs +5 -0
- package/esm2020/lib/components/add-files-btn/add-files-btn.component.mjs +53 -0
- package/esm2020/lib/components/editor/external-video-block/external-video-block.component.mjs +45 -0
- package/esm2020/lib/components/editor/html-raw-editor/html-raw-editor.component.mjs +25 -0
- package/esm2020/lib/components/editor/image-editor/image-editor.component.mjs +50 -0
- package/esm2020/lib/components/editor/index.mjs +8 -0
- package/esm2020/lib/components/editor/main-editor/main-editor.component.mjs +76 -0
- package/esm2020/lib/components/editor/main-editor-block/main-editor-block.component.mjs +41 -0
- package/esm2020/lib/components/editor/text-editor/text-editor.component.mjs +34 -0
- package/esm2020/lib/components/editor/visual-editor/visual-editor.component.mjs +161 -0
- package/esm2020/lib/components/file-id-select/file-id-select.component.mjs +62 -0
- package/esm2020/lib/components/index.mjs +6 -0
- package/esm2020/lib/components/upload-files-btn/upload-files-btn.component.mjs +54 -0
- package/esm2020/lib/components/xml-tags/index.mjs +9 -0
- package/esm2020/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.mjs +43 -0
- package/esm2020/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.mjs +17 -0
- package/esm2020/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.mjs +18 -0
- package/esm2020/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.mjs +16 -0
- package/esm2020/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.mjs +20 -0
- package/esm2020/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.mjs +20 -0
- package/esm2020/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.mjs +17 -0
- package/esm2020/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.mjs +21 -0
- package/esm2020/lib/croco-html.module.mjs +90 -0
- package/esm2020/lib/extensions/AngularMaterialTableMethods.mjs +64 -0
- package/esm2020/lib/extensions/BodyTagsExtensions.mjs +120 -0
- package/esm2020/lib/extensions/BootstrapTableMethods.mjs +67 -0
- package/esm2020/lib/extensions/HtmlExtractionMethods.mjs +63 -0
- package/esm2020/lib/extensions/HtmlRawTagDataConsts.mjs +4 -0
- package/esm2020/lib/extensions/ImageMethods.mjs +24 -0
- package/esm2020/lib/extensions/InterfaceBlock.mjs +2 -0
- package/esm2020/lib/extensions/TableBuilder.mjs +35 -0
- package/esm2020/lib/extensions/TableMethods.mjs +108 -0
- package/esm2020/lib/extensions/TextMethods.mjs +29 -0
- package/esm2020/lib/extensions/TextSimpleMethods.mjs +77 -0
- package/esm2020/lib/extensions/VideoMethods.mjs +20 -0
- package/esm2020/lib/extensions/XmlExtensions.mjs +26 -0
- package/esm2020/lib/extensions/index.mjs +13 -0
- package/esm2020/lib/index.mjs +113 -0
- package/esm2020/lib/models/models.mjs +2 -0
- package/esm2020/lib/pipes/RichTextToHtmlPipe.mjs +26 -0
- package/esm2020/lib/pipes/TagToSpanPipe.mjs +16 -0
- package/esm2020/lib/pipes/ToHtmlBodyTagsPipe.mjs +17 -0
- package/esm2020/lib/pipes/index.mjs +5 -0
- package/esm2020/lib/pipes/to-preview.pipe.mjs +17 -0
- package/esm2020/lib/services/file-upload.service.mjs +40 -0
- package/esm2020/lib/services/files-query.service.mjs +27 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/croco-html.mjs +1565 -0
- package/fesm2015/croco-html.mjs.map +1 -0
- package/fesm2020/croco-html.mjs +1568 -0
- package/fesm2020/croco-html.mjs.map +1 -0
- package/lib/components/add-files-btn/add-files-btn.component.d.ts +18 -0
- package/lib/components/editor/external-video-block/external-video-block.component.d.ts +19 -0
- package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +11 -0
- package/lib/components/editor/image-editor/image-editor.component.d.ts +20 -0
- package/lib/components/editor/index.d.ts +7 -0
- package/lib/components/editor/main-editor/main-editor.component.d.ts +28 -0
- package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +16 -0
- package/lib/components/editor/text-editor/text-editor.component.d.ts +14 -0
- package/lib/components/editor/visual-editor/visual-editor.component.d.ts +43 -0
- package/lib/components/file-id-select/file-id-select.component.d.ts +30 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +24 -0
- package/{src/lib/components/xml-tags/index.ts → lib/components/xml-tags/index.d.ts} +8 -8
- package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +17 -0
- package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +10 -0
- package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +10 -0
- package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +7 -0
- package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +10 -0
- package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +7 -0
- package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +10 -0
- package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +8 -0
- package/lib/croco-html.module.d.ts +60 -0
- package/lib/extensions/AngularMaterialTableMethods.d.ts +10 -0
- package/lib/extensions/BodyTagsExtensions.d.ts +10 -0
- package/lib/extensions/BootstrapTableMethods.d.ts +9 -0
- package/lib/extensions/HtmlExtractionMethods.d.ts +69 -0
- package/lib/extensions/HtmlRawTagDataConsts.d.ts +3 -0
- package/lib/extensions/ImageMethods.d.ts +17 -0
- package/lib/extensions/InterfaceBlock.d.ts +4 -0
- package/lib/extensions/TableBuilder.d.ts +5 -0
- package/lib/extensions/TableMethods.d.ts +58 -0
- package/lib/extensions/TextMethods.d.ts +19 -0
- package/lib/extensions/TextSimpleMethods.d.ts +23 -0
- package/lib/extensions/VideoMethods.d.ts +19 -0
- package/lib/extensions/XmlExtensions.d.ts +5 -0
- package/lib/extensions/index.d.ts +10 -0
- package/lib/index.d.ts +20 -0
- package/{src/lib/models/models.ts → lib/models/models.d.ts} +1 -2
- package/lib/pipes/RichTextToHtmlPipe.d.ts +8 -0
- package/lib/pipes/TagToSpanPipe.d.ts +7 -0
- package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +8 -0
- package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
- package/lib/pipes/to-preview.pipe.d.ts +8 -0
- package/lib/services/file-upload.service.d.ts +23 -0
- package/lib/services/files-query.service.d.ts +42 -0
- package/package.json +34 -14
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/components/add-files-btn/add-files-btn.component.css +0 -0
- package/src/lib/components/add-files-btn/add-files-btn.component.html +0 -14
- package/src/lib/components/add-files-btn/add-files-btn.component.ts +0 -61
- package/src/lib/components/editor/external-video-block/external-video-block.component.css +0 -0
- package/src/lib/components/editor/external-video-block/external-video-block.component.html +0 -27
- package/src/lib/components/editor/external-video-block/external-video-block.component.ts +0 -45
- package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.css +0 -0
- package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.html +0 -17
- package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.ts +0 -22
- package/src/lib/components/editor/image-editor/image-editor.component.css +0 -7
- package/src/lib/components/editor/image-editor/image-editor.component.html +0 -54
- package/src/lib/components/editor/image-editor/image-editor.component.ts +0 -52
- package/src/lib/components/editor/index.ts +0 -7
- package/src/lib/components/editor/main-editor/main-editor.component.css +0 -48
- package/src/lib/components/editor/main-editor/main-editor.component.html +0 -39
- package/src/lib/components/editor/main-editor/main-editor.component.ts +0 -71
- package/src/lib/components/editor/main-editor-block/main-editor-block.component.css +0 -0
- package/src/lib/components/editor/main-editor-block/main-editor-block.component.html +0 -41
- package/src/lib/components/editor/main-editor-block/main-editor-block.component.ts +0 -39
- package/src/lib/components/editor/text-editor/text-editor.component.css +0 -0
- package/src/lib/components/editor/text-editor/text-editor.component.html +0 -39
- package/src/lib/components/editor/text-editor/text-editor.component.ts +0 -30
- package/src/lib/components/editor/visual-editor/visual-editor.component.css +0 -48
- package/src/lib/components/editor/visual-editor/visual-editor.component.html +0 -84
- package/src/lib/components/editor/visual-editor/visual-editor.component.ts +0 -180
- package/src/lib/components/file-id-select/file-id-select.component.css +0 -0
- package/src/lib/components/file-id-select/file-id-select.component.html +0 -39
- package/src/lib/components/file-id-select/file-id-select.component.ts +0 -75
- package/src/lib/components/index.ts +0 -5
- package/src/lib/components/upload-files-btn/upload-files-btn.component.css +0 -0
- package/src/lib/components/upload-files-btn/upload-files-btn.component.html +0 -2
- package/src/lib/components/upload-files-btn/upload-files-btn.component.ts +0 -57
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.css +0 -15
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html +0 -8
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts +0 -59
- package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.html +0 -18
- package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.ts +0 -19
- package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.html +0 -25
- package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts +0 -19
- package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.html +0 -3
- package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.ts +0 -14
- package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.html +0 -2
- package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts +0 -19
- package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.html +0 -9
- package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.ts +0 -15
- package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.css +0 -0
- package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.html +0 -21
- package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.ts +0 -18
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.css +0 -4
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.html +0 -44
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.ts +0 -17
- package/src/lib/croco-html.module.ts +0 -22
- package/src/lib/extensions/AngularMaterialTableMethods.ts +0 -87
- package/src/lib/extensions/BodyTagsExtensions.ts +0 -151
- package/src/lib/extensions/BootstrapTableMethods.ts +0 -87
- package/src/lib/extensions/HtmlExtractionMethods.ts +0 -78
- package/src/lib/extensions/HtmlRawTagDataConsts.ts +0 -3
- package/src/lib/extensions/ImageMethods.ts +0 -37
- package/src/lib/extensions/InterfaceBlock.ts +0 -5
- package/src/lib/extensions/TableBuilder.ts +0 -50
- package/src/lib/extensions/TableMethods.ts +0 -175
- package/src/lib/extensions/TextMethods.ts +0 -51
- package/src/lib/extensions/TextSimpleMethods.ts +0 -120
- package/src/lib/extensions/VideoMethods.ts +0 -31
- package/src/lib/extensions/XmlExtensions.ts +0 -26
- package/src/lib/extensions/index.ts +0 -12
- package/src/lib/index.ts +0 -119
- package/src/lib/pipes/RichTextToHtmlPipe.ts +0 -25
- package/src/lib/pipes/TagToSpanPipe.ts +0 -10
- package/src/lib/pipes/ToHtmlBodyTagsPipe.ts +0 -14
- package/src/lib/pipes/to-preview.pipe.ts +0 -12
- package/src/lib/services/file-upload.service.ts +0 -56
- package/src/lib/services/files-query.service.ts +0 -72
- package/src/test.ts +0 -28
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
|
3
|
-
import { InterfaceBlock } from "../../../extensions/InterfaceBlock";
|
|
4
|
-
import { ExternalVideoTagData } from '../../../extensions/VideoMethods';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'croco-html-xml-tag-external-video',
|
|
8
|
-
templateUrl: './xml-tag-external-video.component.html',
|
|
9
|
-
styleUrls: ['./xml-tag-external-video.component.css']
|
|
10
|
-
})
|
|
11
|
-
export class XmlTagExternalVideoComponent implements OnInit {
|
|
12
|
-
|
|
13
|
-
@Input()
|
|
14
|
-
data: InterfaceBlock;
|
|
15
|
-
|
|
16
|
-
@Input()
|
|
17
|
-
tagData: ExternalVideoTagData;
|
|
18
|
-
|
|
19
|
-
widgetUrl: SafeResourceUrl;
|
|
20
|
-
|
|
21
|
-
getYouTubeId(youtubeLink:string){
|
|
22
|
-
|
|
23
|
-
//https://www.youtube.com/watch?v=l3KfbfkxJOU
|
|
24
|
-
if(youtubeLink.includes("watch?v=")){
|
|
25
|
-
var url = new URL(youtubeLink);
|
|
26
|
-
return url.searchParams.get("v");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//https://youtu.be/jzBneaWSswY
|
|
30
|
-
let bits = youtubeLink.split('/')
|
|
31
|
-
return bits[bits.length - 1];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getWidgetLink(youtubeLink:string){
|
|
35
|
-
|
|
36
|
-
let id = this.getYouTubeId(youtubeLink);
|
|
37
|
-
|
|
38
|
-
let result = `https://www.youtube.com/embed/${id}?controls=0`;
|
|
39
|
-
|
|
40
|
-
this.widgetUrl = this._domSanitizer.bypassSecurityTrustResourceUrl(result);
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
constructor(private _domSanitizer: DomSanitizer) { }
|
|
47
|
-
|
|
48
|
-
ngOnInit(): void {
|
|
49
|
-
if(this.data != null){
|
|
50
|
-
this.tagData = this.data.data as ExternalVideoTagData;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let youtubeWidgetLink = this.getWidgetLink(this.tagData.link);
|
|
54
|
-
this.widgetUrl = this._domSanitizer.bypassSecurityTrustResourceUrl(youtubeWidgetLink);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<h1 *ngIf="item.type === 'h1'"
|
|
2
|
-
[innerHtml]="item.data.html">
|
|
3
|
-
</h1>
|
|
4
|
-
<h2 *ngIf="item.type === 'h2'"
|
|
5
|
-
[innerHtml]="item.data.html">
|
|
6
|
-
</h2>
|
|
7
|
-
<h3 *ngIf="item.type === 'h3'"
|
|
8
|
-
[innerHtml]="item.data.html">
|
|
9
|
-
</h3>
|
|
10
|
-
<h4 *ngIf="item.type === 'h4'"
|
|
11
|
-
[innerHtml]="item.data.html">
|
|
12
|
-
</h4>
|
|
13
|
-
<h5 *ngIf="item.type === 'h5'"
|
|
14
|
-
[innerHtml]="item.data.html">
|
|
15
|
-
</h5>
|
|
16
|
-
<h6 *ngIf="item.type === 'h6'"
|
|
17
|
-
[innerHtml]="item.data.html">
|
|
18
|
-
</h6>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { GenericTextTag } from '../../../extensions/TextSimpleMethods';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'croco-html-xml-tag-header-inner-text-view',
|
|
6
|
-
templateUrl: './xml-tag-header-inner-text-view.component.html',
|
|
7
|
-
styleUrls: ['./xml-tag-header-inner-text-view.component.css']
|
|
8
|
-
})
|
|
9
|
-
export class XmlTagHeaderInnerTextViewComponent implements OnInit {
|
|
10
|
-
|
|
11
|
-
@Input()
|
|
12
|
-
item: GenericTextTag;
|
|
13
|
-
|
|
14
|
-
constructor() { }
|
|
15
|
-
|
|
16
|
-
ngOnInit(): void {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.css
DELETED
|
File without changes
|
package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.html
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'left'" style="text-align: left;">
|
|
2
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
3
|
-
<croco-html-xml-tag-header-inner-text-view *ngIf="item.data.html.length > 0" [item]="item">
|
|
4
|
-
</croco-html-xml-tag-header-inner-text-view>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'right'" style="text-align: right;">
|
|
8
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
9
|
-
<croco-html-xml-tag-header-inner-text-view *ngIf="item.data.html.length > 0" [item]="item">
|
|
10
|
-
</croco-html-xml-tag-header-inner-text-view>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'center'" style="text-align: center;">
|
|
14
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
15
|
-
|
|
16
|
-
<croco-html-xml-tag-header-inner-text-view *ngIf="item.data.html.length > 0" [item]="item">
|
|
17
|
-
</croco-html-xml-tag-header-inner-text-view>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<div *ngIf="!item.data.validationResult.isSucceeded" class="red" style="margin-top: 10px;" >
|
|
21
|
-
<h4>Допущена ошибка в теге <text></h4>
|
|
22
|
-
<span>
|
|
23
|
-
{{item.data.validationResult.message}}
|
|
24
|
-
</span>
|
|
25
|
-
</div>
|
package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { GenericTextTag } from '../../../extensions/TextSimpleMethods';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'croco-html-xml-tag-header-text-view',
|
|
6
|
-
templateUrl: './xml-tag-header-text-view.component.html',
|
|
7
|
-
styleUrls: ['./xml-tag-header-text-view.component.css']
|
|
8
|
-
})
|
|
9
|
-
export class XmlTagHeaderTextViewComponent implements OnInit {
|
|
10
|
-
|
|
11
|
-
@Input()
|
|
12
|
-
item: GenericTextTag;
|
|
13
|
-
|
|
14
|
-
constructor() { }
|
|
15
|
-
|
|
16
|
-
ngOnInit(): void {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'croco-html-xml-tag-html-view',
|
|
5
|
-
templateUrl: './xml-tag-html-view.component.html',
|
|
6
|
-
styleUrls: ['./xml-tag-html-view.component.css']
|
|
7
|
-
})
|
|
8
|
-
export class XmlTagHtmlViewComponent {
|
|
9
|
-
|
|
10
|
-
constructor() { }
|
|
11
|
-
|
|
12
|
-
@Input()
|
|
13
|
-
html: string = "";
|
|
14
|
-
}
|
package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.css
DELETED
|
File without changes
|
package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { RichTextData } from '../../../extensions/TextMethods';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'croco-html-xml-tag-rich-text-view',
|
|
6
|
-
templateUrl: './xml-tag-rich-text-view.component.html',
|
|
7
|
-
styleUrls: ['./xml-tag-rich-text-view.component.css']
|
|
8
|
-
})
|
|
9
|
-
export class XmlTagRichTextViewComponent implements OnInit {
|
|
10
|
-
|
|
11
|
-
@Input()
|
|
12
|
-
richTextData: RichTextData = null;
|
|
13
|
-
|
|
14
|
-
constructor() { }
|
|
15
|
-
|
|
16
|
-
ngOnInit(): void {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
|
File without changes
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<table mat-table [dataSource]="data" class="mat-elevation-z8 w-100 example-container">
|
|
2
|
-
<ng-container [matColumnDef]="column" *ngFor="let column of displayedColumns">
|
|
3
|
-
<th mat-header-cell *matHeaderCellDef> {{column}} </th>
|
|
4
|
-
<td mat-cell *matCellDef="let element"> {{element[column]}} </td>
|
|
5
|
-
</ng-container>
|
|
6
|
-
|
|
7
|
-
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
8
|
-
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
9
|
-
</table>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'croco-html-xml-tag-table-view',
|
|
5
|
-
templateUrl: './xml-tag-table-view.component.html',
|
|
6
|
-
styleUrls: ['./xml-tag-table-view.component.css']
|
|
7
|
-
})
|
|
8
|
-
export class XmlTagTableViewComponent {
|
|
9
|
-
|
|
10
|
-
@Input()
|
|
11
|
-
displayedColumns: string[] = [];
|
|
12
|
-
|
|
13
|
-
@Input()
|
|
14
|
-
data: object;
|
|
15
|
-
}
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'left'" style="text-align: left;">
|
|
2
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
3
|
-
<span *ngIf="item.data.html.length > 0" [innerHtml]="item.data.html"></span>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'right'" style="text-align: right;">
|
|
7
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
8
|
-
<span *ngIf="item.data.html.length > 0" [innerHtml]="item.data.html"></span>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div *ngIf="item.data.validationResult.isSucceeded && item.data.horizontalAlignment === 'center'" style="text-align: center;">
|
|
12
|
-
<span *ngIf="item.data.html.length === 0 || !item.data.html"> </span>
|
|
13
|
-
<span *ngIf="item.data.html.length > 0" [innerHtml]="item.data.html"></span>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div *ngIf="!item.data.validationResult.isSucceeded" class="red" style="margin-top: 10px;" >
|
|
17
|
-
<h4>Допущена ошибка в теге <text></h4>
|
|
18
|
-
<span>
|
|
19
|
-
{{item.data.validationResult.message}}
|
|
20
|
-
</span>
|
|
21
|
-
</div>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { SimpleTextTag } from '../../../extensions/TextSimpleMethods';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'croco-html-xml-tag-text-view',
|
|
6
|
-
templateUrl: './xml-tag-text-view.component.html',
|
|
7
|
-
styleUrls: ['./xml-tag-text-view.component.css']
|
|
8
|
-
})
|
|
9
|
-
export class XmlTagTextViewComponent implements OnInit {
|
|
10
|
-
|
|
11
|
-
@Input()
|
|
12
|
-
item: SimpleTextTag;
|
|
13
|
-
|
|
14
|
-
constructor() { }
|
|
15
|
-
|
|
16
|
-
ngOnInit(): void {
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<div class="">
|
|
2
|
-
<div class="row" *ngFor="let item of data">
|
|
3
|
-
<div *ngIf="item.type === 'text'">
|
|
4
|
-
<croco-html-xml-tag-text-view [item]="item"></croco-html-xml-tag-text-view>
|
|
5
|
-
</div>
|
|
6
|
-
<div *ngIf="item.type === 'image'" class="red" style="margin-top: 10px;" >
|
|
7
|
-
<h4>Данный тег больше больше не поддерживается</h4>
|
|
8
|
-
<span>
|
|
9
|
-
Вмето этого переименуйте тег image на file-image
|
|
10
|
-
</span>
|
|
11
|
-
</div>
|
|
12
|
-
<div *ngIf="item.type === 'html-raw'" [innerHTML]="item.data.innerHTML">
|
|
13
|
-
</div>
|
|
14
|
-
<div *ngIf="item.type === 'h1' || item.type === 'h2' || item.type === 'h3' || item.type === 'h4' || item.type === 'h5' || item.type === 'h6'">
|
|
15
|
-
<croco-html-xml-tag-header-text-view [item]="item"></croco-html-xml-tag-header-text-view>
|
|
16
|
-
</div>
|
|
17
|
-
<div *ngIf="item.type === 'file-image'">
|
|
18
|
-
<img class="mx-auto d-block img-fluid" [src]="item.data.src"/>
|
|
19
|
-
</div>
|
|
20
|
-
<div *ngIf="item.type === 'table'">
|
|
21
|
-
|
|
22
|
-
<croco-html-xml-tag-html-view *ngIf="item.validationResult.isSucceeded" [html]="item.bootstrapHtml">
|
|
23
|
-
</croco-html-xml-tag-html-view>
|
|
24
|
-
|
|
25
|
-
<app-tutor-baseapiresponse-banner
|
|
26
|
-
*ngIf="item.validationResult && !item.validationResult.isSucceeded"
|
|
27
|
-
[message]="item.validationResult.message">
|
|
28
|
-
</app-tutor-baseapiresponse-banner>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div *ngIf="item.type === 'rich-text'">
|
|
32
|
-
<croco-html-xml-tag-text-view [richTextData]="item"></croco-html-xml-tag-text-view>
|
|
33
|
-
</div>
|
|
34
|
-
<div *ngIf="item.type === 'external-video'">
|
|
35
|
-
<croco-html-xml-tag-external-video [data]="item"></croco-html-xml-tag-external-video>
|
|
36
|
-
</div>
|
|
37
|
-
<div *ngIf="item.type === 'unsupported-tag'" class="red" style="margin-top: 10px;" >
|
|
38
|
-
<h4>Данный тег не поддерживается</h4>
|
|
39
|
-
<span>
|
|
40
|
-
{{item.data.tagString}}
|
|
41
|
-
</span>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { InterfaceBlock } from "../../../extensions/InterfaceBlock";
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'croco-html-xml-tag-view',
|
|
6
|
-
templateUrl: './xml-tag-view.component.html',
|
|
7
|
-
styleUrls: ['./xml-tag-view.component.css'],
|
|
8
|
-
encapsulation: ViewEncapsulation.None,
|
|
9
|
-
})
|
|
10
|
-
export class XmlTagViewComponent {
|
|
11
|
-
|
|
12
|
-
@Input()
|
|
13
|
-
data:InterfaceBlock[] = [];
|
|
14
|
-
|
|
15
|
-
constructor() { }
|
|
16
|
-
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
-
import { NgModule } from "@angular/core";
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
4
|
-
import { NgSelectModule } from "@ng-select/ng-select";
|
|
5
|
-
import { CrocoHtmlDeclarations, MaterialModules } from ".";
|
|
6
|
-
|
|
7
|
-
@NgModule({
|
|
8
|
-
declarations: [
|
|
9
|
-
...CrocoHtmlDeclarations
|
|
10
|
-
],
|
|
11
|
-
exports: [
|
|
12
|
-
...CrocoHtmlDeclarations,
|
|
13
|
-
],
|
|
14
|
-
imports: [
|
|
15
|
-
CommonModule,
|
|
16
|
-
FormsModule,
|
|
17
|
-
ReactiveFormsModule,
|
|
18
|
-
NgSelectModule,
|
|
19
|
-
...MaterialModules
|
|
20
|
-
]
|
|
21
|
-
})
|
|
22
|
-
export class CrocoHtmlModule { }
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { BaseApiResponse, TableData, TableRowData } from './TableMethods';
|
|
2
|
-
export interface AngularMaterialTableData {
|
|
3
|
-
displayedColumns: string[];
|
|
4
|
-
data: object[];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export class AngularMaterialTableMethods {
|
|
8
|
-
static getAngularMaterialTableData(columns: string[], rows: TableRowData[]): AngularMaterialTableData {
|
|
9
|
-
|
|
10
|
-
let data: object[] = [];
|
|
11
|
-
|
|
12
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
13
|
-
const row = rows[rowIndex];
|
|
14
|
-
|
|
15
|
-
var elem = {};
|
|
16
|
-
|
|
17
|
-
for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {
|
|
18
|
-
const column = columns[columnIndex];
|
|
19
|
-
|
|
20
|
-
elem[column] = row.columns[columnIndex].data.text;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
data.push(elem);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
displayedColumns: columns,
|
|
28
|
-
data: data,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static checkHeaders(tableData: TableData): BaseApiResponse {
|
|
33
|
-
if(tableData.header === null){
|
|
34
|
-
return {
|
|
35
|
-
isSucceeded: false,
|
|
36
|
-
message: "Необходимо указать заголовок таблицы"
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let columns: string[] = tableData.header.columns;
|
|
41
|
-
|
|
42
|
-
var uniqueDislayedColumns = columns.filter((v, i, a) => a.indexOf(v) === i);
|
|
43
|
-
|
|
44
|
-
if (uniqueDislayedColumns.length !== columns.length) {
|
|
45
|
-
return {
|
|
46
|
-
isSucceeded: false,
|
|
47
|
-
message: "Ошибка при обработке разметки таблицы. Обнаружены дубликаты заголовков."
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
isSucceeded: true,
|
|
53
|
-
message: "Ok"
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
static checkAngularMaterialTableData(tableData: TableData, checkHeaders: boolean = true): BaseApiResponse {
|
|
57
|
-
|
|
58
|
-
if(checkHeaders){
|
|
59
|
-
var checkHeadersResult = this.checkHeaders(tableData);
|
|
60
|
-
|
|
61
|
-
if(!checkHeadersResult.isSucceeded){
|
|
62
|
-
return checkHeadersResult;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let rows: TableRowData[] = tableData.rows;
|
|
67
|
-
let columns: string[] = tableData.header.columns;
|
|
68
|
-
|
|
69
|
-
for (let i = 0; i < rows.length; i++) {
|
|
70
|
-
const row = rows[i];
|
|
71
|
-
|
|
72
|
-
if (row.columns.length !== columns.length) {
|
|
73
|
-
return {
|
|
74
|
-
isSucceeded: false,
|
|
75
|
-
message: `Ошибка при обработке разметки таблицы. `
|
|
76
|
-
+ `Количество колонок в каждой строке таблицы должно соотвествовать количеству колонок указанных в заголовке. `
|
|
77
|
-
+ `В строке таблицы №${i + 1} количество колонок = ${row.columns.length}, а должно быть ${columns.length}.`
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
isSucceeded: true,
|
|
84
|
-
message: "Ok"
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { HtmlBodyTag } from "../models/models";
|
|
2
|
-
import { HtmlExtractionMethods } from "./HtmlExtractionMethods";
|
|
3
|
-
import { InterfaceBlock } from "./InterfaceBlock";
|
|
4
|
-
import { HtmlRawTagDataConsts } from "./HtmlRawTagDataConsts";
|
|
5
|
-
import { FileImageTagData, FileImageTagDataConsts } from "./ImageMethods";
|
|
6
|
-
import { TextMethods } from "./TextMethods";
|
|
7
|
-
import { SimpleTextTagData } from "./TextSimpleMethods";
|
|
8
|
-
import { ExternalVideoTagDataConsts } from "./VideoMethods";
|
|
9
|
-
|
|
10
|
-
export class BodyTagsExtensions {
|
|
11
|
-
|
|
12
|
-
static getDescription(tagName: string){
|
|
13
|
-
var descriptions = {
|
|
14
|
-
"text": "Текст",
|
|
15
|
-
"h1": "Заголовок 1 уровня",
|
|
16
|
-
"h2": "Заголовок 2 уровня",
|
|
17
|
-
"h3": "Заголовок 3 уровня",
|
|
18
|
-
"h4": "Заголовок 4 уровня",
|
|
19
|
-
"h5": "Заголовок 5 уровня",
|
|
20
|
-
"h6": "Заголовок 6 уровня",
|
|
21
|
-
[FileImageTagDataConsts.TagName]: "Изображение",
|
|
22
|
-
[ExternalVideoTagDataConsts.TagName]: "Внешнее видео YouTube",
|
|
23
|
-
[HtmlRawTagDataConsts.TagName]: "Html разметка"
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return descriptions[tagName];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static toHtml(bodyTags: HtmlBodyTag[]): string{
|
|
30
|
-
let htmls = bodyTags.map(x => {
|
|
31
|
-
if(TextMethods.textTags.includes(x.tagDescription.tag)){
|
|
32
|
-
return `<${x.tagDescription.tag} h-align="${x.attributes['h-align']}">${x.innerHtml}</${x.tagDescription.tag}>`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if(x.tagDescription.tag === ExternalVideoTagDataConsts.TagName){
|
|
36
|
-
return `<${x.tagDescription.tag} type="${x.attributes['type']}" link="${x.attributes['link']}">${x.innerHtml}</${x.tagDescription.tag}>`
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if(x.tagDescription.tag === "html-raw"){
|
|
40
|
-
return `<${x.tagDescription.tag}>${x.innerHtml}</${x.tagDescription.tag}>`
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return BodyTagsExtensions.imageTagToHtml(x);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
let result = "";
|
|
47
|
-
|
|
48
|
-
for (let index = 0; index < htmls.length; index++) {
|
|
49
|
-
const element = htmls[index];
|
|
50
|
-
|
|
51
|
-
result += element;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static imageTagToHtml(imageTag: HtmlBodyTag){
|
|
58
|
-
|
|
59
|
-
var attrStr = "";
|
|
60
|
-
|
|
61
|
-
var attrValue = imageTag.attributes[FileImageTagDataConsts.FileIdAttrName];
|
|
62
|
-
if(imageTag.attributes.hasOwnProperty(FileImageTagDataConsts.FileIdAttrName) && attrValue){
|
|
63
|
-
attrStr = `${FileImageTagDataConsts.FileIdAttrName}="${attrValue}"`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return `<${FileImageTagDataConsts.TagName} ${attrStr}></${FileImageTagDataConsts.TagName}>`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static getBodyTags(html:string){
|
|
70
|
-
let result = HtmlExtractionMethods.transformHtmlStringToBlocks(html);
|
|
71
|
-
return result.map(x => BodyTagsExtensions.toBodyTag(x));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static sanitizeInnerHtml(html:string):string{
|
|
75
|
-
return html.trim().replace('\n\t', '');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static toBodyTag(data: InterfaceBlock): HtmlBodyTag {
|
|
79
|
-
if (TextMethods.textTags.includes(data.type)) {
|
|
80
|
-
let textTagData = data.data as SimpleTextTagData;
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
presentOrEdit: true,
|
|
84
|
-
tagDescription: {
|
|
85
|
-
tag: textTagData.textTagName,
|
|
86
|
-
displayValue: BodyTagsExtensions.getDescription(data.type)
|
|
87
|
-
},
|
|
88
|
-
attributes: { "h-align": textTagData.horizontalAlignment },
|
|
89
|
-
innerHtml: BodyTagsExtensions.sanitizeInnerHtml(textTagData.html)
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if(data.type === FileImageTagDataConsts.TagName){
|
|
94
|
-
|
|
95
|
-
let fileData = data.data as FileImageTagData;
|
|
96
|
-
|
|
97
|
-
let atts = {};
|
|
98
|
-
|
|
99
|
-
if(fileData.fileId){
|
|
100
|
-
atts[FileImageTagDataConsts.FileIdAttrName] = fileData.fileId;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
presentOrEdit: true,
|
|
105
|
-
tagDescription: {
|
|
106
|
-
tag: FileImageTagDataConsts.TagName,
|
|
107
|
-
displayValue: BodyTagsExtensions.getDescription(data.type)
|
|
108
|
-
},
|
|
109
|
-
attributes: atts,
|
|
110
|
-
innerHtml: ""
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if(data.type === ExternalVideoTagDataConsts.TagName){
|
|
115
|
-
let fileData = data.data as ExternalVideoTagDataConsts;
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
presentOrEdit: true,
|
|
119
|
-
tagDescription: {
|
|
120
|
-
tag: ExternalVideoTagDataConsts.TagName,
|
|
121
|
-
displayValue: BodyTagsExtensions.getDescription(data.type)
|
|
122
|
-
},
|
|
123
|
-
attributes: fileData,
|
|
124
|
-
innerHtml: ""
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if(data.type === HtmlRawTagDataConsts.TagName){
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
presentOrEdit: true,
|
|
132
|
-
tagDescription: {
|
|
133
|
-
tag: HtmlRawTagDataConsts.TagName,
|
|
134
|
-
displayValue: BodyTagsExtensions.getDescription(data.type)
|
|
135
|
-
},
|
|
136
|
-
attributes: {},
|
|
137
|
-
innerHtml: BodyTagsExtensions.sanitizeInnerHtml(data.data["innerHTML"])
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
presentOrEdit: true,
|
|
143
|
-
tagDescription: {
|
|
144
|
-
tag: "unsupported-tag",
|
|
145
|
-
displayValue: "Неподдерживаемый тег"
|
|
146
|
-
},
|
|
147
|
-
attributes: { },
|
|
148
|
-
innerHtml: JSON.stringify(data)
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|