croco-html 0.1.1 → 0.1.2

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 (183) hide show
  1. package/croco-html.d.ts +5 -0
  2. package/esm2020/croco-html.mjs +5 -0
  3. package/esm2020/lib/components/add-files-btn/add-files-btn.component.mjs +53 -0
  4. package/esm2020/lib/components/editor/external-video-block/external-video-block.component.mjs +45 -0
  5. package/esm2020/lib/components/editor/html-raw-editor/html-raw-editor.component.mjs +25 -0
  6. package/esm2020/lib/components/editor/image-editor/image-editor.component.mjs +50 -0
  7. package/esm2020/lib/components/editor/index.mjs +8 -0
  8. package/esm2020/lib/components/editor/main-editor/main-editor.component.mjs +76 -0
  9. package/esm2020/lib/components/editor/main-editor-block/main-editor-block.component.mjs +41 -0
  10. package/esm2020/lib/components/editor/text-editor/text-editor.component.mjs +34 -0
  11. package/esm2020/lib/components/editor/visual-editor/visual-editor.component.mjs +161 -0
  12. package/esm2020/lib/components/file-id-select/file-id-select.component.mjs +62 -0
  13. package/esm2020/lib/components/index.mjs +6 -0
  14. package/esm2020/lib/components/upload-files-btn/upload-files-btn.component.mjs +54 -0
  15. package/esm2020/lib/components/xml-tags/index.mjs +9 -0
  16. package/esm2020/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.mjs +43 -0
  17. package/esm2020/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.mjs +17 -0
  18. package/esm2020/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.mjs +18 -0
  19. package/esm2020/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.mjs +16 -0
  20. package/esm2020/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.mjs +20 -0
  21. package/esm2020/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.mjs +20 -0
  22. package/esm2020/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.mjs +17 -0
  23. package/esm2020/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.mjs +21 -0
  24. package/esm2020/lib/croco-html.module.mjs +90 -0
  25. package/esm2020/lib/extensions/AngularMaterialTableMethods.mjs +64 -0
  26. package/esm2020/lib/extensions/BodyTagsExtensions.mjs +120 -0
  27. package/esm2020/lib/extensions/BootstrapTableMethods.mjs +67 -0
  28. package/esm2020/lib/extensions/HtmlExtractionMethods.mjs +63 -0
  29. package/esm2020/lib/extensions/HtmlRawTagDataConsts.mjs +4 -0
  30. package/esm2020/lib/extensions/ImageMethods.mjs +24 -0
  31. package/esm2020/lib/extensions/InterfaceBlock.mjs +2 -0
  32. package/esm2020/lib/extensions/TableBuilder.mjs +35 -0
  33. package/esm2020/lib/extensions/TableMethods.mjs +108 -0
  34. package/esm2020/lib/extensions/TextMethods.mjs +29 -0
  35. package/esm2020/lib/extensions/TextSimpleMethods.mjs +77 -0
  36. package/esm2020/lib/extensions/VideoMethods.mjs +20 -0
  37. package/esm2020/lib/extensions/XmlExtensions.mjs +26 -0
  38. package/esm2020/lib/extensions/index.mjs +13 -0
  39. package/esm2020/lib/index.mjs +113 -0
  40. package/esm2020/lib/models/models.mjs +2 -0
  41. package/esm2020/lib/pipes/RichTextToHtmlPipe.mjs +26 -0
  42. package/esm2020/lib/pipes/TagToSpanPipe.mjs +16 -0
  43. package/esm2020/lib/pipes/ToHtmlBodyTagsPipe.mjs +17 -0
  44. package/esm2020/lib/pipes/index.mjs +5 -0
  45. package/esm2020/lib/pipes/to-preview.pipe.mjs +17 -0
  46. package/esm2020/lib/services/file-upload.service.mjs +40 -0
  47. package/esm2020/lib/services/files-query.service.mjs +27 -0
  48. package/esm2020/public-api.mjs +8 -0
  49. package/fesm2015/croco-html.mjs +1565 -0
  50. package/fesm2015/croco-html.mjs.map +1 -0
  51. package/fesm2020/croco-html.mjs +1568 -0
  52. package/fesm2020/croco-html.mjs.map +1 -0
  53. package/lib/components/add-files-btn/add-files-btn.component.d.ts +18 -0
  54. package/lib/components/editor/external-video-block/external-video-block.component.d.ts +19 -0
  55. package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +11 -0
  56. package/lib/components/editor/image-editor/image-editor.component.d.ts +20 -0
  57. package/lib/components/editor/index.d.ts +7 -0
  58. package/lib/components/editor/main-editor/main-editor.component.d.ts +28 -0
  59. package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +16 -0
  60. package/lib/components/editor/text-editor/text-editor.component.d.ts +14 -0
  61. package/lib/components/editor/visual-editor/visual-editor.component.d.ts +43 -0
  62. package/lib/components/file-id-select/file-id-select.component.d.ts +30 -0
  63. package/lib/components/index.d.ts +5 -0
  64. package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +24 -0
  65. package/{src/lib/components/xml-tags/index.ts → lib/components/xml-tags/index.d.ts} +8 -8
  66. package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +17 -0
  67. package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +10 -0
  68. package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +10 -0
  69. package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +7 -0
  70. package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +10 -0
  71. package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +7 -0
  72. package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +10 -0
  73. package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +8 -0
  74. package/lib/croco-html.module.d.ts +60 -0
  75. package/lib/extensions/AngularMaterialTableMethods.d.ts +10 -0
  76. package/lib/extensions/BodyTagsExtensions.d.ts +10 -0
  77. package/lib/extensions/BootstrapTableMethods.d.ts +9 -0
  78. package/lib/extensions/HtmlExtractionMethods.d.ts +69 -0
  79. package/lib/extensions/HtmlRawTagDataConsts.d.ts +3 -0
  80. package/lib/extensions/ImageMethods.d.ts +17 -0
  81. package/lib/extensions/InterfaceBlock.d.ts +4 -0
  82. package/lib/extensions/TableBuilder.d.ts +5 -0
  83. package/lib/extensions/TableMethods.d.ts +58 -0
  84. package/lib/extensions/TextMethods.d.ts +19 -0
  85. package/lib/extensions/TextSimpleMethods.d.ts +23 -0
  86. package/lib/extensions/VideoMethods.d.ts +19 -0
  87. package/lib/extensions/XmlExtensions.d.ts +5 -0
  88. package/lib/extensions/index.d.ts +10 -0
  89. package/lib/index.d.ts +20 -0
  90. package/{src/lib/models/models.ts → lib/models/models.d.ts} +1 -2
  91. package/lib/pipes/RichTextToHtmlPipe.d.ts +8 -0
  92. package/lib/pipes/TagToSpanPipe.d.ts +7 -0
  93. package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +8 -0
  94. package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
  95. package/lib/pipes/to-preview.pipe.d.ts +8 -0
  96. package/lib/services/file-upload.service.d.ts +23 -0
  97. package/lib/services/files-query.service.d.ts +42 -0
  98. package/package.json +34 -14
  99. package/{src/public-api.ts → public-api.d.ts} +0 -4
  100. package/karma.conf.js +0 -44
  101. package/ng-package.json +0 -7
  102. package/src/lib/components/add-files-btn/add-files-btn.component.css +0 -0
  103. package/src/lib/components/add-files-btn/add-files-btn.component.html +0 -14
  104. package/src/lib/components/add-files-btn/add-files-btn.component.ts +0 -61
  105. package/src/lib/components/editor/external-video-block/external-video-block.component.css +0 -0
  106. package/src/lib/components/editor/external-video-block/external-video-block.component.html +0 -27
  107. package/src/lib/components/editor/external-video-block/external-video-block.component.ts +0 -45
  108. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.css +0 -0
  109. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.html +0 -17
  110. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.ts +0 -22
  111. package/src/lib/components/editor/image-editor/image-editor.component.css +0 -7
  112. package/src/lib/components/editor/image-editor/image-editor.component.html +0 -54
  113. package/src/lib/components/editor/image-editor/image-editor.component.ts +0 -52
  114. package/src/lib/components/editor/index.ts +0 -7
  115. package/src/lib/components/editor/main-editor/main-editor.component.css +0 -48
  116. package/src/lib/components/editor/main-editor/main-editor.component.html +0 -39
  117. package/src/lib/components/editor/main-editor/main-editor.component.ts +0 -71
  118. package/src/lib/components/editor/main-editor-block/main-editor-block.component.css +0 -0
  119. package/src/lib/components/editor/main-editor-block/main-editor-block.component.html +0 -41
  120. package/src/lib/components/editor/main-editor-block/main-editor-block.component.ts +0 -39
  121. package/src/lib/components/editor/text-editor/text-editor.component.css +0 -0
  122. package/src/lib/components/editor/text-editor/text-editor.component.html +0 -39
  123. package/src/lib/components/editor/text-editor/text-editor.component.ts +0 -30
  124. package/src/lib/components/editor/visual-editor/visual-editor.component.css +0 -48
  125. package/src/lib/components/editor/visual-editor/visual-editor.component.html +0 -84
  126. package/src/lib/components/editor/visual-editor/visual-editor.component.ts +0 -180
  127. package/src/lib/components/file-id-select/file-id-select.component.css +0 -0
  128. package/src/lib/components/file-id-select/file-id-select.component.html +0 -39
  129. package/src/lib/components/file-id-select/file-id-select.component.ts +0 -75
  130. package/src/lib/components/index.ts +0 -5
  131. package/src/lib/components/upload-files-btn/upload-files-btn.component.css +0 -0
  132. package/src/lib/components/upload-files-btn/upload-files-btn.component.html +0 -2
  133. package/src/lib/components/upload-files-btn/upload-files-btn.component.ts +0 -57
  134. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.css +0 -15
  135. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html +0 -8
  136. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts +0 -59
  137. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.css +0 -0
  138. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.html +0 -18
  139. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.ts +0 -19
  140. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.css +0 -0
  141. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.html +0 -25
  142. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts +0 -19
  143. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.css +0 -0
  144. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.html +0 -3
  145. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.ts +0 -14
  146. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.css +0 -0
  147. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.html +0 -2
  148. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts +0 -19
  149. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.css +0 -0
  150. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.html +0 -9
  151. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.ts +0 -15
  152. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.css +0 -0
  153. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.html +0 -21
  154. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.ts +0 -18
  155. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.css +0 -4
  156. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.html +0 -44
  157. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.ts +0 -17
  158. package/src/lib/croco-html.module.ts +0 -22
  159. package/src/lib/extensions/AngularMaterialTableMethods.ts +0 -87
  160. package/src/lib/extensions/BodyTagsExtensions.ts +0 -151
  161. package/src/lib/extensions/BootstrapTableMethods.ts +0 -87
  162. package/src/lib/extensions/HtmlExtractionMethods.ts +0 -78
  163. package/src/lib/extensions/HtmlRawTagDataConsts.ts +0 -3
  164. package/src/lib/extensions/ImageMethods.ts +0 -37
  165. package/src/lib/extensions/InterfaceBlock.ts +0 -5
  166. package/src/lib/extensions/TableBuilder.ts +0 -50
  167. package/src/lib/extensions/TableMethods.ts +0 -175
  168. package/src/lib/extensions/TextMethods.ts +0 -51
  169. package/src/lib/extensions/TextSimpleMethods.ts +0 -120
  170. package/src/lib/extensions/VideoMethods.ts +0 -31
  171. package/src/lib/extensions/XmlExtensions.ts +0 -26
  172. package/src/lib/extensions/index.ts +0 -12
  173. package/src/lib/index.ts +0 -119
  174. package/src/lib/pipes/RichTextToHtmlPipe.ts +0 -25
  175. package/src/lib/pipes/TagToSpanPipe.ts +0 -10
  176. package/src/lib/pipes/ToHtmlBodyTagsPipe.ts +0 -14
  177. package/src/lib/pipes/to-preview.pipe.ts +0 -12
  178. package/src/lib/services/file-upload.service.ts +0 -56
  179. package/src/lib/services/files-query.service.ts +0 -72
  180. package/src/test.ts +0 -28
  181. package/tsconfig.lib.json +0 -20
  182. package/tsconfig.lib.prod.json +0 -10
  183. package/tsconfig.spec.json +0 -17
@@ -1,41 +0,0 @@
1
- <div>
2
- <div>
3
- <div *ngIf="textTags.includes(tag.tagDescription.tag)">
4
- <croco-html-text-editor (onTagUpdated)="tagUpdatedHandler($event)" [tag]="tag">
5
- </croco-html-text-editor>
6
- </div>
7
-
8
- <div *ngIf="tag.tagDescription.tag === 'file-image'">
9
- <croco-html-image-editor (onTagUpdated)="tagUpdatedHandler($event)" [tag]="tag">
10
- </croco-html-image-editor>
11
- </div>
12
-
13
- <div *ngIf="tag.tagDescription.tag === 'external-video'">
14
- <croco-html-external-video-block (onTagUpdated)="tagUpdatedHandler($event)" [tag]="tag">
15
- </croco-html-external-video-block>
16
- </div>
17
-
18
- <div *ngIf="tag.tagDescription.tag === 'html-raw'">
19
- <croco-html-html-raw-editor (onTagUpdated)="tagUpdatedHandler($event)" [tag]="tag">
20
- </croco-html-html-raw-editor>
21
- </div>
22
-
23
- </div>
24
-
25
- <div class="d-flex justify-content-between">
26
- <div class="d-flex justify-content-end align-self-center">
27
- <div>
28
- <button *ngIf="tag.presentOrEdit" (click)="tag.presentOrEdit = false" mat-icon-button>
29
- <mat-icon>edit</mat-icon>
30
- </button>
31
- <button *ngIf="!tag.presentOrEdit" (click)="save()" mat-icon-button>
32
- <mat-icon>save</mat-icon>
33
- </button>
34
- <button (click)="deleteItem()" mat-icon-button color="warn">
35
- <mat-icon>delete</mat-icon>
36
- </button>
37
- </div>
38
- </div>
39
-
40
- </div>
41
- </div>
@@ -1,39 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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>
@@ -1,30 +0,0 @@
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
- }
@@ -1,48 +0,0 @@
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
- }
@@ -1,84 +0,0 @@
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>
@@ -1,180 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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>
@@ -1,75 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- export * from './add-files-btn/add-files-btn.component'
2
- export * from './editor/'
3
- export * from './file-id-select/file-id-select.component'
4
- export * from './upload-files-btn/upload-files-btn.component'
5
- export * from './xml-tags'
@@ -1,2 +0,0 @@
1
- <button [hidden]="hidden" mat-raised-button color="primary" (click)="filesInput.click()">{{btnText}}</button>
2
- <input [hidden]="true" [accept]="extAccepts" [multiple]="isMultiple" type="file" #filesInput (change)="handleFileInput($event.target.files)" />
@@ -1,57 +0,0 @@
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,15 +0,0 @@
1
- @media only screen and (min-width: 769px) {
2
- .y-video {
3
- width: 640px;
4
- height: 360px;
5
- margin: 0 auto;
6
- }
7
- }
8
-
9
- @media only screen and (max-width: 768px) {
10
- .y-video {
11
- width: 560px;
12
- height: 315px;
13
- margin: 0 auto;
14
- }
15
- }
@@ -1,8 +0,0 @@
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>