croco-html 0.0.1 → 0.1.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.
- package/README.md +24 -24
- package/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +14 -22
- 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 +14 -0
- package/src/lib/components/add-files-btn/add-files-btn.component.ts +61 -0
- 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 +27 -0
- package/src/lib/components/editor/external-video-block/external-video-block.component.ts +45 -0
- 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 +17 -0
- package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.ts +22 -0
- package/src/lib/components/editor/image-editor/image-editor.component.css +7 -0
- package/src/lib/components/editor/image-editor/image-editor.component.html +54 -0
- package/src/lib/components/editor/image-editor/image-editor.component.ts +52 -0
- package/src/lib/components/editor/index.ts +7 -0
- package/src/lib/components/editor/main-editor/main-editor.component.css +48 -0
- package/src/lib/components/editor/main-editor/main-editor.component.html +39 -0
- package/src/lib/components/editor/main-editor/main-editor.component.ts +71 -0
- 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 +41 -0
- package/src/lib/components/editor/main-editor-block/main-editor-block.component.ts +39 -0
- package/src/lib/components/editor/text-editor/text-editor.component.css +0 -0
- package/src/lib/components/editor/text-editor/text-editor.component.html +39 -0
- package/src/lib/components/editor/text-editor/text-editor.component.ts +30 -0
- package/src/lib/components/editor/visual-editor/visual-editor.component.css +48 -0
- package/src/lib/components/editor/visual-editor/visual-editor.component.html +84 -0
- package/src/lib/components/editor/visual-editor/visual-editor.component.ts +180 -0
- 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 +39 -0
- package/src/lib/components/file-id-select/file-id-select.component.ts +75 -0
- package/src/lib/components/index.ts +5 -0
- 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 +2 -0
- package/src/lib/components/upload-files-btn/upload-files-btn.component.ts +57 -0
- package/{lib/components/xml-tags/index.d.ts → src/lib/components/xml-tags/index.ts} +8 -8
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.css +15 -0
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html +8 -0
- package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts +59 -0
- 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 +18 -0
- package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.ts +19 -0
- 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 +25 -0
- package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts +19 -0
- 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 +3 -0
- package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.ts +14 -0
- 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 +2 -0
- package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts +19 -0
- 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 +9 -0
- package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.ts +15 -0
- 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 +21 -0
- package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.ts +18 -0
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.css +4 -0
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.html +44 -0
- package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.ts +17 -0
- package/src/lib/croco-html.module.ts +22 -0
- package/src/lib/extensions/AngularMaterialTableMethods.ts +87 -0
- package/src/lib/extensions/BodyTagsExtensions.ts +151 -0
- package/src/lib/extensions/BootstrapTableMethods.ts +87 -0
- package/src/lib/extensions/HtmlExtractionMethods.ts +78 -0
- package/src/lib/extensions/HtmlRawTagDataConsts.ts +3 -0
- package/src/lib/extensions/ImageMethods.ts +37 -0
- package/{lib/extensions/InterfaceBlock.d.ts → src/lib/extensions/InterfaceBlock.ts} +5 -4
- package/src/lib/extensions/TableBuilder.ts +50 -0
- package/src/lib/extensions/TableMethods.ts +175 -0
- package/src/lib/extensions/TextMethods.ts +51 -0
- package/src/lib/extensions/TextSimpleMethods.ts +120 -0
- package/src/lib/extensions/VideoMethods.ts +31 -0
- package/src/lib/extensions/XmlExtensions.ts +26 -0
- package/src/lib/extensions/index.ts +12 -0
- package/src/lib/index.ts +119 -0
- package/{lib/models/models.d.ts → src/lib/models/models.ts} +11 -10
- package/src/lib/pipes/RichTextToHtmlPipe.ts +25 -0
- package/src/lib/pipes/TagToSpanPipe.ts +10 -0
- package/src/lib/pipes/ToHtmlBodyTagsPipe.ts +14 -0
- package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +4 -4
- package/src/lib/pipes/to-preview.pipe.ts +12 -0
- package/src/lib/services/file-upload.service.ts +56 -0
- package/src/lib/services/files-query.service.ts +72 -0
- package/{public-api.d.ts → src/public-api.ts} +8 -4
- package/src/test.ts +28 -0
- package/tsconfig.lib.json +20 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/croco-html.umd.js +0 -2091
- package/bundles/croco-html.umd.js.map +0 -1
- package/croco-html.d.ts +0 -5
- package/esm2015/croco-html.js +0 -5
- package/esm2015/lib/components/add-files-btn/add-files-btn.component.js +0 -57
- package/esm2015/lib/components/editor/external-video-block/external-video-block.component.js +0 -49
- package/esm2015/lib/components/editor/html-raw-editor/html-raw-editor.component.js +0 -29
- package/esm2015/lib/components/editor/image-editor/image-editor.component.js +0 -54
- package/esm2015/lib/components/editor/index.js +0 -8
- package/esm2015/lib/components/editor/main-editor/main-editor.component.js +0 -80
- package/esm2015/lib/components/editor/main-editor-block/main-editor-block.component.js +0 -45
- package/esm2015/lib/components/editor/text-editor/text-editor.component.js +0 -38
- package/esm2015/lib/components/editor/visual-editor/visual-editor.component.js +0 -165
- package/esm2015/lib/components/file-id-select/file-id-select.component.js +0 -66
- package/esm2015/lib/components/index.js +0 -6
- package/esm2015/lib/components/upload-files-btn/upload-files-btn.component.js +0 -58
- package/esm2015/lib/components/xml-tags/index.js +0 -9
- package/esm2015/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.js +0 -47
- package/esm2015/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.js +0 -21
- package/esm2015/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.js +0 -22
- package/esm2015/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.js +0 -20
- package/esm2015/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.js +0 -24
- package/esm2015/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.js +0 -24
- package/esm2015/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.js +0 -21
- package/esm2015/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.js +0 -26
- package/esm2015/lib/croco-html.module.js +0 -90
- package/esm2015/lib/extensions/AngularMaterialTableMethods.js +0 -64
- package/esm2015/lib/extensions/BodyTagsExtensions.js +0 -120
- package/esm2015/lib/extensions/BootstrapTableMethods.js +0 -67
- package/esm2015/lib/extensions/HtmlExtractionMethods.js +0 -63
- package/esm2015/lib/extensions/HtmlRawTagDataConsts.js +0 -4
- package/esm2015/lib/extensions/ImageMethods.js +0 -24
- package/esm2015/lib/extensions/InterfaceBlock.js +0 -2
- package/esm2015/lib/extensions/TableBuilder.js +0 -35
- package/esm2015/lib/extensions/TableMethods.js +0 -100
- package/esm2015/lib/extensions/TextMethods.js +0 -29
- package/esm2015/lib/extensions/TextSimpleMethods.js +0 -78
- package/esm2015/lib/extensions/VideoMethods.js +0 -20
- package/esm2015/lib/extensions/XmlExtensions.js +0 -26
- package/esm2015/lib/extensions/index.js +0 -13
- package/esm2015/lib/index.js +0 -113
- package/esm2015/lib/models/models.js +0 -2
- package/esm2015/lib/pipes/RichTextToHtmlPipe.js +0 -26
- package/esm2015/lib/pipes/TagToSpanPipe.js +0 -16
- package/esm2015/lib/pipes/ToHtmlBodyTagsPipe.js +0 -17
- package/esm2015/lib/pipes/index.js +0 -5
- package/esm2015/lib/pipes/to-preview.pipe.js +0 -17
- package/esm2015/lib/services/file-upload.service.js +0 -40
- package/esm2015/lib/services/files-query.service.js +0 -27
- package/esm2015/public-api.js +0 -8
- package/fesm2015/croco-html.js +0 -1634
- package/fesm2015/croco-html.js.map +0 -1
- package/lib/components/add-files-btn/add-files-btn.component.d.ts +0 -18
- package/lib/components/editor/external-video-block/external-video-block.component.d.ts +0 -19
- package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +0 -11
- package/lib/components/editor/image-editor/image-editor.component.d.ts +0 -20
- package/lib/components/editor/index.d.ts +0 -7
- package/lib/components/editor/main-editor/main-editor.component.d.ts +0 -28
- package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +0 -16
- package/lib/components/editor/text-editor/text-editor.component.d.ts +0 -14
- package/lib/components/editor/visual-editor/visual-editor.component.d.ts +0 -43
- package/lib/components/file-id-select/file-id-select.component.d.ts +0 -30
- package/lib/components/index.d.ts +0 -5
- package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +0 -24
- package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +0 -17
- package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +0 -10
- package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +0 -10
- package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +0 -7
- package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +0 -10
- package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +0 -7
- package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +0 -10
- package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +0 -8
- package/lib/croco-html.module.d.ts +0 -60
- package/lib/extensions/AngularMaterialTableMethods.d.ts +0 -10
- package/lib/extensions/BodyTagsExtensions.d.ts +0 -10
- package/lib/extensions/BootstrapTableMethods.d.ts +0 -9
- package/lib/extensions/HtmlExtractionMethods.d.ts +0 -69
- package/lib/extensions/HtmlRawTagDataConsts.d.ts +0 -3
- package/lib/extensions/ImageMethods.d.ts +0 -17
- package/lib/extensions/TableBuilder.d.ts +0 -5
- package/lib/extensions/TableMethods.d.ts +0 -58
- package/lib/extensions/TextMethods.d.ts +0 -19
- package/lib/extensions/TextSimpleMethods.d.ts +0 -23
- package/lib/extensions/VideoMethods.d.ts +0 -19
- package/lib/extensions/XmlExtensions.d.ts +0 -5
- package/lib/extensions/index.d.ts +0 -10
- package/lib/index.d.ts +0 -20
- package/lib/pipes/RichTextToHtmlPipe.d.ts +0 -8
- package/lib/pipes/TagToSpanPipe.d.ts +0 -7
- package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +0 -8
- package/lib/pipes/to-preview.pipe.d.ts +0 -8
- package/lib/services/file-upload.service.d.ts +0 -23
- package/lib/services/files-query.service.d.ts +0 -42
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { TextMethods } from '../../../extensions/TextMethods';
|
|
3
|
+
import { HtmlBodyTag } from '../../../models/models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'croco-html-main-editor-block',
|
|
7
|
+
templateUrl: './main-editor-block.component.html',
|
|
8
|
+
styleUrls: ['./main-editor-block.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class MainEditorBlockComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
textTags = TextMethods.textTags;
|
|
13
|
+
|
|
14
|
+
@Input()
|
|
15
|
+
tag:HtmlBodyTag;
|
|
16
|
+
|
|
17
|
+
@Output()
|
|
18
|
+
onTagSaved = new EventEmitter<HtmlBodyTag>();
|
|
19
|
+
|
|
20
|
+
@Output()
|
|
21
|
+
onTagRemoved = new EventEmitter<HtmlBodyTag>();
|
|
22
|
+
|
|
23
|
+
constructor() { }
|
|
24
|
+
|
|
25
|
+
tagUpdatedHandler(tag:HtmlBodyTag):void{
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
save(){
|
|
29
|
+
this.tag.presentOrEdit = true;
|
|
30
|
+
this.onTagSaved.emit(this.tag);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
deleteItem(){
|
|
34
|
+
this.onTagRemoved.emit(this.tag);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ngOnInit(): void {
|
|
38
|
+
}
|
|
39
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<div *ngIf="tag.presentOrEdit">
|
|
2
|
+
<div style="height: 10px;">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div style="text-align: left;" *ngIf="tag.attributes['h-align'] === 'left'" [innerHtml]="getInnerHtml()">
|
|
6
|
+
</div>
|
|
7
|
+
<div style="text-align: right;" *ngIf="tag.attributes['h-align'] === 'right'" [innerHtml]="getInnerHtml()">
|
|
8
|
+
</div>
|
|
9
|
+
<div style="text-align: center;" *ngIf="tag.attributes['h-align'] === 'center'" [innerHtml]="getInnerHtml()">
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div *ngIf="!tag.presentOrEdit">
|
|
14
|
+
<div style="overflow-x: auto;">
|
|
15
|
+
<mat-button-toggle-group [(ngModel)]="tag.attributes['h-align']">
|
|
16
|
+
<mat-button-toggle value="center">
|
|
17
|
+
По центру <mat-icon>format_align_center</mat-icon>
|
|
18
|
+
</mat-button-toggle>
|
|
19
|
+
<mat-button-toggle value="left">
|
|
20
|
+
Слева <mat-icon>format_align_left</mat-icon>
|
|
21
|
+
</mat-button-toggle>
|
|
22
|
+
<mat-button-toggle value="right">
|
|
23
|
+
Справа <mat-icon> format_align_right</mat-icon>
|
|
24
|
+
</mat-button-toggle>
|
|
25
|
+
</mat-button-toggle-group>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div style="height: 10px;">
|
|
29
|
+
</div>
|
|
30
|
+
<form [formGroup]="myForm">
|
|
31
|
+
<mat-form-field class="w-100">
|
|
32
|
+
<textarea matInput cdkTextareaAutosize #autosize="cdkTextareaAutosize"
|
|
33
|
+
cdkAutosizeMinRows="1"
|
|
34
|
+
placeholder="Внутренняя разметка текстового тега"
|
|
35
|
+
formControlName="innerHtml"
|
|
36
|
+
[(ngModel)]="tag.innerHtml"></textarea>
|
|
37
|
+
</mat-form-field>
|
|
38
|
+
</form>
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { HtmlBodyTag } from '../../../models/models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'croco-html-text-editor',
|
|
7
|
+
templateUrl: './text-editor.component.html',
|
|
8
|
+
styleUrls: ['./text-editor.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class TextEditorComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
myForm = new FormGroup({
|
|
13
|
+
"innerHtml": new FormControl()
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
@Input()
|
|
17
|
+
tag: HtmlBodyTag;
|
|
18
|
+
|
|
19
|
+
@Output()
|
|
20
|
+
onTagUpdated = new EventEmitter<HtmlBodyTag>();
|
|
21
|
+
|
|
22
|
+
constructor() { }
|
|
23
|
+
|
|
24
|
+
ngOnInit(): void {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getInnerHtml(){
|
|
28
|
+
return `<${this.tag.tagDescription.tag}>${this.tag.innerHtml}<${this.tag.tagDescription.tag}/>`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.example-list {
|
|
2
|
+
width: 500px;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
border: solid 1px #ccc;
|
|
5
|
+
min-height: 60px;
|
|
6
|
+
display: block;
|
|
7
|
+
background: white;
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.example-box {
|
|
13
|
+
padding: 20px 10px;
|
|
14
|
+
border-bottom: solid 1px #ccc;
|
|
15
|
+
color: rgba(0, 0, 0, 0.87);
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
cursor: move;
|
|
22
|
+
background: white;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cdk-drag-preview {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
|
|
30
|
+
0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
31
|
+
0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cdk-drag-placeholder {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cdk-drag-animating {
|
|
39
|
+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.example-box:last-child {
|
|
43
|
+
border: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) {
|
|
47
|
+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
|
48
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<div *ngIf="isLoading">
|
|
2
|
+
<div>
|
|
3
|
+
<mat-spinner style="margin:0 auto;"></mat-spinner>
|
|
4
|
+
<div style="text-align: center;">{{loadingText}}</div>
|
|
5
|
+
</div>
|
|
6
|
+
<div style="height: 10px;"></div>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div [hidden]="isLoading">
|
|
10
|
+
<div cdkDropList (cdkDropListDropped)="drop($event)">
|
|
11
|
+
<div *ngFor="let tag of bodyTags; let i = index" cdkDrag>
|
|
12
|
+
<mat-card>
|
|
13
|
+
<div class="d-flex justify-content-between">
|
|
14
|
+
<div class="example-handle" cdkDragHandle>
|
|
15
|
+
<svg width="24px" fill="currentColor" viewBox="0 0 24 24">
|
|
16
|
+
<path
|
|
17
|
+
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">
|
|
18
|
+
</path>
|
|
19
|
+
<path d="M0 0h24v24H0z" fill="none"></path>
|
|
20
|
+
</svg>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<mat-chip-list aria-label="Tag display value">
|
|
24
|
+
<mat-chip color="primary" selected>{{tag.tagDescription.displayValue}}</mat-chip>
|
|
25
|
+
</mat-chip-list>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div style="height: 15px;"></div>
|
|
30
|
+
|
|
31
|
+
<croco-html-main-editor-block [tag]="tag"
|
|
32
|
+
(onTagSaved)="onTagSavedHandler($event)"
|
|
33
|
+
(onTagRemoved)="onTagRemovedHandler(i)">
|
|
34
|
+
</croco-html-main-editor-block>
|
|
35
|
+
</mat-card>
|
|
36
|
+
|
|
37
|
+
<div style="height: 10px;">
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
<div [hidden]="isLoading">
|
|
45
|
+
<mat-card>
|
|
46
|
+
<div class="row d-flex align-items-center">
|
|
47
|
+
<div class="col-12">
|
|
48
|
+
<mat-form-field class="w-100" appearance="fill">
|
|
49
|
+
<mat-label>Выберите тег</mat-label>
|
|
50
|
+
<mat-select [(ngModel)]="selectedValue">
|
|
51
|
+
<mat-option *ngFor="let tag of tags" [value]="tag.tag">
|
|
52
|
+
{{tag.displayValue}}
|
|
53
|
+
</mat-option>
|
|
54
|
+
</mat-select>
|
|
55
|
+
</mat-form-field>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="col-12">
|
|
58
|
+
<button (click)="addTag()" class="w-100" mat-stroked-button>
|
|
59
|
+
Добавить тег
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</mat-card>
|
|
64
|
+
|
|
65
|
+
<div style="height: 10px;">
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div [hidden]="isLoading">
|
|
70
|
+
<mat-card>
|
|
71
|
+
<div class="row d-flex align-items-center">
|
|
72
|
+
<div class="col-12">
|
|
73
|
+
<croco-add-files-btn
|
|
74
|
+
(filesTagsReady)="filesTagsReadyHandler($event)"
|
|
75
|
+
(postFilesStarted)="postFilesStartedEventHandler($event)"
|
|
76
|
+
class="w-100">
|
|
77
|
+
</croco-add-files-btn>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</mat-card>
|
|
81
|
+
|
|
82
|
+
<div style="height: 10px;">
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
2
|
+
import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
3
|
+
import { FormGroup, FormControl } from '@angular/forms';
|
|
4
|
+
import { BodyTagsExtensions } from '../../../extensions/BodyTagsExtensions';
|
|
5
|
+
import { HtmlRawTagDataConsts } from '../../../extensions/HtmlRawTagDataConsts';
|
|
6
|
+
import { FileImageTagDataConsts } from '../../../extensions/ImageMethods';
|
|
7
|
+
import { TextMethods } from '../../../extensions/TextMethods';
|
|
8
|
+
import { ExternalVideoTagDataConsts, ExternalVideoSupportedTypes } from '../../../extensions/VideoMethods';
|
|
9
|
+
import { XmlExtensions } from '../../../extensions/XmlExtensions';
|
|
10
|
+
import { TagItem, HtmlBodyTag } from '../../../models/models';
|
|
11
|
+
import { FilePostingStarted } from '../../upload-files-btn/upload-files-btn.component';
|
|
12
|
+
|
|
13
|
+
export class DefaultTags{
|
|
14
|
+
static tags:TagItem[] = [
|
|
15
|
+
{ tag: FileImageTagDataConsts.TagName, displayValue: 'Изображение' },
|
|
16
|
+
{ tag: ExternalVideoTagDataConsts.TagName, displayValue: 'Внешнее видео Youtube' },
|
|
17
|
+
{ tag: 'text', displayValue: 'Текст' },
|
|
18
|
+
{ tag: 'h1', displayValue: 'Заголовок 1 уровня' },
|
|
19
|
+
{ tag: 'h2', displayValue: 'Заголовок 2 уровня' },
|
|
20
|
+
{ tag: 'h3', displayValue: 'Заголовок 3 уровня' },
|
|
21
|
+
{ tag: 'h4', displayValue: 'Заголовок 4 уровня' },
|
|
22
|
+
{ tag: 'h5', displayValue: 'Заголовок 5 уровня' },
|
|
23
|
+
{ tag: 'h6', displayValue: 'Заголовок 6 уровня' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
static htmlRawTag:TagItem = {
|
|
27
|
+
tag: HtmlRawTagDataConsts.TagName, displayValue: 'Html разметка'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getTags(useHtmlRaw:boolean):TagItem[]{
|
|
31
|
+
var result = [...DefaultTags.tags];
|
|
32
|
+
|
|
33
|
+
if(useHtmlRaw){
|
|
34
|
+
result.push(DefaultTags.htmlRawTag);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Component({
|
|
42
|
+
selector: 'croco-visual-editor',
|
|
43
|
+
templateUrl: './visual-editor.component.html',
|
|
44
|
+
styleUrls: ['./visual-editor.component.css']
|
|
45
|
+
})
|
|
46
|
+
export class VisualEditorComponent implements OnInit, AfterViewInit {
|
|
47
|
+
|
|
48
|
+
isLoading = false;
|
|
49
|
+
loadingText = "Идёт загрузка";
|
|
50
|
+
|
|
51
|
+
@Input()
|
|
52
|
+
showMarkUp = true;
|
|
53
|
+
|
|
54
|
+
myForm = new FormGroup({
|
|
55
|
+
"html": new FormControl(),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
tags: TagItem[] = [];
|
|
59
|
+
|
|
60
|
+
selectedValue: string;
|
|
61
|
+
|
|
62
|
+
@Input()
|
|
63
|
+
useHtmlRaw = false;
|
|
64
|
+
|
|
65
|
+
@Input()
|
|
66
|
+
@Output()
|
|
67
|
+
html: string = "";
|
|
68
|
+
|
|
69
|
+
isHtmlSet(){
|
|
70
|
+
return this.html.startsWith("<body>");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
clearHtml(){
|
|
74
|
+
this.html = "";
|
|
75
|
+
this.recalculateBodyTags();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getHtml(){
|
|
79
|
+
this.recalculateHtml();
|
|
80
|
+
return this.html;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Output()
|
|
84
|
+
onHtmlChanged = new EventEmitter<string>();
|
|
85
|
+
|
|
86
|
+
@Output()
|
|
87
|
+
rendered = new EventEmitter<boolean>();
|
|
88
|
+
|
|
89
|
+
bodyTags: HtmlBodyTag[] = [];
|
|
90
|
+
|
|
91
|
+
constructor(
|
|
92
|
+
private _cdref: ChangeDetectorRef) { }
|
|
93
|
+
|
|
94
|
+
ngAfterViewInit(): void {
|
|
95
|
+
this.rendered.emit(true);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ngAfterContentChecked(): void {
|
|
99
|
+
this._cdref.detectChanges();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
addTag(): void {
|
|
103
|
+
let tagDescription = this.tags
|
|
104
|
+
.find(x => x.tag === this.selectedValue);
|
|
105
|
+
|
|
106
|
+
let attrs = {};
|
|
107
|
+
let innerHtml = "";
|
|
108
|
+
|
|
109
|
+
if(TextMethods.textTags.includes(tagDescription.tag)){
|
|
110
|
+
attrs["h-align"] = "left";
|
|
111
|
+
innerHtml = "Введите ваш текст";
|
|
112
|
+
}
|
|
113
|
+
else if(tagDescription.tag == ExternalVideoTagDataConsts.TagName){
|
|
114
|
+
attrs[ExternalVideoTagDataConsts.VideoTypeAttrName] = ExternalVideoSupportedTypes.Youtube;
|
|
115
|
+
attrs[ExternalVideoTagDataConsts.LinkAttrName] = null;
|
|
116
|
+
}
|
|
117
|
+
else{
|
|
118
|
+
attrs[FileImageTagDataConsts.FileIdAttrName] = null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.bodyTags.push({
|
|
122
|
+
tagDescription,
|
|
123
|
+
innerHtml,
|
|
124
|
+
attributes: attrs,
|
|
125
|
+
presentOrEdit: true
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
this.recalculateHtml();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
postFilesStartedEventHandler(model:FilePostingStarted){
|
|
132
|
+
this.loadingText = "Файлы загружаются на сервер";
|
|
133
|
+
this.isLoading = true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
addTagCustom(tag: HtmlBodyTag){
|
|
137
|
+
this.bodyTags.push(tag);
|
|
138
|
+
this.recalculateHtml();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
filesTagsReadyHandler(tags: HtmlBodyTag[]){
|
|
142
|
+
for(let i = 0; i < tags.length; i++){
|
|
143
|
+
this.bodyTags.push(tags[i]);
|
|
144
|
+
}
|
|
145
|
+
this.recalculateHtml();
|
|
146
|
+
|
|
147
|
+
this.isLoading = false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
drop(event: CdkDragDrop<object[]>) {
|
|
151
|
+
moveItemInArray(this.bodyTags, event.previousIndex, event.currentIndex);
|
|
152
|
+
this.recalculateHtml();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
onTagSavedHandler(tag: HtmlBodyTag){
|
|
156
|
+
this.recalculateHtml();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
onTagRemovedHandler(index: number){
|
|
160
|
+
this.bodyTags.splice(index, 1);
|
|
161
|
+
this.recalculateHtml();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
recalculateHtml(){
|
|
165
|
+
let result = BodyTagsExtensions.toHtml(this.bodyTags);
|
|
166
|
+
this.html = XmlExtensions.formatXml("<body>" + result + "</body>");
|
|
167
|
+
this.onHtmlChanged.emit(this.html);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
recalculateBodyTags(){
|
|
171
|
+
this.bodyTags = BodyTagsExtensions.getBodyTags(this.html);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
ngOnInit(): void {
|
|
175
|
+
this.recalculateBodyTags();
|
|
176
|
+
|
|
177
|
+
this.tags = DefaultTags.getTags(this.useHtmlRaw);
|
|
178
|
+
this.selectedValue = this.tags[0].tag;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<form [formGroup]="form">
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<label for="fileName">{{labelText}}</label>
|
|
4
|
+
<ng-select [(ngModel)]="fileId" (ngModelChange)="onModelChanged($event)"
|
|
5
|
+
[items]="files"
|
|
6
|
+
#select
|
|
7
|
+
bindLabel="fileName"
|
|
8
|
+
(search)="onSearchChanged($event)"
|
|
9
|
+
[loading]="loading"
|
|
10
|
+
[loadingText]="'Загружаю файлы'"
|
|
11
|
+
dropdownPosition="auto"
|
|
12
|
+
bindValue="fileId"
|
|
13
|
+
labelForId="fileName"
|
|
14
|
+
placeholder="Выбрать файл"
|
|
15
|
+
[virtualScroll]="true"
|
|
16
|
+
formControlName="fileName">
|
|
17
|
+
<ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm">
|
|
18
|
+
<div>
|
|
19
|
+
<img class="mx-auto d-block img-fluid" [src]="getSrc(item.fileId)"/>
|
|
20
|
+
</div>
|
|
21
|
+
<div>
|
|
22
|
+
<span class="h5">Файл: </span>
|
|
23
|
+
<span class="h5" [ngOptionHighlight]="search"><b>{{item.fileName}}</b></span>
|
|
24
|
+
</div>
|
|
25
|
+
<div>
|
|
26
|
+
<small>
|
|
27
|
+
<span>
|
|
28
|
+
Идентификатор файла: <b>{{item.fileId}}</b>
|
|
29
|
+
</span>
|
|
30
|
+
</small>
|
|
31
|
+
</div>
|
|
32
|
+
</ng-template>
|
|
33
|
+
</ng-select>
|
|
34
|
+
</div>
|
|
35
|
+
</form>
|
|
36
|
+
|
|
37
|
+
<div>
|
|
38
|
+
Идентификатор файла: {{fileId}}
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
3
|
+
import { ImageMethods } from '../../extensions/ImageMethods';
|
|
4
|
+
import { FileNameAndIdModel, FilesQueryService } from '../../services/files-query.service';
|
|
5
|
+
|
|
6
|
+
export interface SearchQuestionsFormData{
|
|
7
|
+
q: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'croco-html-file-id-select',
|
|
12
|
+
templateUrl: './file-id-select.component.html',
|
|
13
|
+
styleUrls: ['./file-id-select.component.css']
|
|
14
|
+
})
|
|
15
|
+
export class FileIdSelectComponent implements OnInit, OnChanges {
|
|
16
|
+
|
|
17
|
+
q: string;
|
|
18
|
+
|
|
19
|
+
@Input()
|
|
20
|
+
labelText = "Поиск файлов"
|
|
21
|
+
|
|
22
|
+
@Input()
|
|
23
|
+
@Output()
|
|
24
|
+
fileId: number;
|
|
25
|
+
|
|
26
|
+
loading = false;
|
|
27
|
+
|
|
28
|
+
form: FormGroup;
|
|
29
|
+
files: FileNameAndIdModel[] = [];
|
|
30
|
+
|
|
31
|
+
@Output()
|
|
32
|
+
onFileIdChanged = new EventEmitter<number>();
|
|
33
|
+
|
|
34
|
+
constructor(
|
|
35
|
+
private fb: FormBuilder,
|
|
36
|
+
private _fileService: FilesQueryService) {
|
|
37
|
+
this.form = this.fb.group({
|
|
38
|
+
fileName: '',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onModelChanged(fileId: number){
|
|
43
|
+
this.onFileIdChanged.emit(fileId);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getSrc(fileId: number){
|
|
47
|
+
return ImageMethods.buildSmallUrl(fileId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ngOnInit(): void {
|
|
51
|
+
this.loadFiles();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public loadFiles() {
|
|
55
|
+
this.loading = true;
|
|
56
|
+
this._fileService.getFiles({
|
|
57
|
+
count: 10,
|
|
58
|
+
offSet: 0,
|
|
59
|
+
fileName: null,
|
|
60
|
+
q: this.q
|
|
61
|
+
}).subscribe(data => {
|
|
62
|
+
this.files = [...data.list];
|
|
63
|
+
this.loading = false;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onSearchChanged(q: {term: string, items:object[]}){
|
|
68
|
+
this.q = q.term;
|
|
69
|
+
this.loadFiles();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
73
|
+
this.loadFiles();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { BaseApiResponseWithFilesIds, FileUploadService } from '../../services/file-upload.service';
|
|
3
|
+
|
|
4
|
+
export interface FilePostingStarted {
|
|
5
|
+
filesCount: number;
|
|
6
|
+
createLocalCopiesNow:boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-upload-files-btn',
|
|
11
|
+
templateUrl: './upload-files-btn.component.html',
|
|
12
|
+
styleUrls: ['./upload-files-btn.component.css']
|
|
13
|
+
})
|
|
14
|
+
export class UploadFilesBtnComponent implements OnInit {
|
|
15
|
+
|
|
16
|
+
constructor(private _fileUploadService: FileUploadService) { }
|
|
17
|
+
@ViewChild('filesInput') private fileInput!: ElementRef<HTMLInputElement>;
|
|
18
|
+
|
|
19
|
+
@Input()
|
|
20
|
+
extAccepts: string = "*/*";
|
|
21
|
+
|
|
22
|
+
@Input()
|
|
23
|
+
isMultiple: boolean = true;
|
|
24
|
+
|
|
25
|
+
@Input()
|
|
26
|
+
btnText: string = "Загрузить файлы";
|
|
27
|
+
|
|
28
|
+
@Input()
|
|
29
|
+
createLocalCopiesNow = false;
|
|
30
|
+
|
|
31
|
+
@Input()
|
|
32
|
+
hidden: boolean = false;
|
|
33
|
+
|
|
34
|
+
@Output()
|
|
35
|
+
postFilesStarted = new EventEmitter<FilePostingStarted>();
|
|
36
|
+
|
|
37
|
+
@Output()
|
|
38
|
+
onFilesUploaded = new EventEmitter<BaseApiResponseWithFilesIds>();
|
|
39
|
+
|
|
40
|
+
handleFileInput(files: FileList) {
|
|
41
|
+
this.postFilesStarted.emit({
|
|
42
|
+
filesCount:files.length,
|
|
43
|
+
createLocalCopiesNow: this.createLocalCopiesNow
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
this._fileUploadService.postFiles(files, this.createLocalCopiesNow).subscribe(data => {
|
|
47
|
+
this.onFilesUploaded.emit(data);
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
clickFileInput(){
|
|
52
|
+
this.fileInput.nativeElement.click();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ngOnInit() {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './xml-tag-external-video/xml-tag-external-video.component'
|
|
2
|
-
export * from './xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component'
|
|
3
|
-
export * from './xml-tag-header-text-view/xml-tag-header-text-view.component'
|
|
4
|
-
export * from './xml-tag-html-view/xml-tag-html-view.component'
|
|
5
|
-
export * from './xml-tag-rich-text-view/xml-tag-rich-text-view.component'
|
|
6
|
-
export * from './xml-tag-table-view/xml-tag-table-view.component'
|
|
7
|
-
export * from './xml-tag-text-view/xml-tag-text-view.component'
|
|
8
|
-
export * from './xml-tag-view/xml-tag-view.component'
|
|
1
|
+
export * from './xml-tag-external-video/xml-tag-external-video.component'
|
|
2
|
+
export * from './xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component'
|
|
3
|
+
export * from './xml-tag-header-text-view/xml-tag-header-text-view.component'
|
|
4
|
+
export * from './xml-tag-html-view/xml-tag-html-view.component'
|
|
5
|
+
export * from './xml-tag-rich-text-view/xml-tag-rich-text-view.component'
|
|
6
|
+
export * from './xml-tag-table-view/xml-tag-table-view.component'
|
|
7
|
+
export * from './xml-tag-text-view/xml-tag-text-view.component'
|
|
8
|
+
export * from './xml-tag-view/xml-tag-view.component'
|
package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div class="d-flex justify-content-center">
|
|
2
|
+
<div *ngIf="widgetUrl" class="y-video">
|
|
3
|
+
<iframe width="100%" height="100%" [src]="widgetUrl"
|
|
4
|
+
title="YouTube video player" frameborder="0"
|
|
5
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
6
|
+
allowfullscreen></iframe>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|