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
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# CrocoHtml
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project croco-html` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project croco-html`.
|
|
8
|
-
> Note: Don't forget to add `--project croco-html` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build croco-html` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build croco-html`, go to the dist folder `cd dist/croco-html` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test croco-html` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
1
|
+
# CrocoHtml
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project croco-html` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project croco-html`.
|
|
8
|
+
> Note: Don't forget to add `--project croco-html` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build croco-html` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build croco-html`, go to the dist folder `cd dist/croco-html` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test croco-html` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, '../../coverage/croco-html'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "croco-html",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "
|
|
6
|
-
"@angular/core": "
|
|
7
|
-
"@angular/material": "
|
|
8
|
-
"@angular/cdk": "
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
"main": "bundles/croco-html.umd.js",
|
|
17
|
-
"module": "fesm2015/croco-html.js",
|
|
18
|
-
"es2015": "fesm2015/croco-html.js",
|
|
19
|
-
"esm2015": "esm2015/croco-html.js",
|
|
20
|
-
"fesm2015": "fesm2015/croco-html.js",
|
|
21
|
-
"typings": "croco-html.d.ts",
|
|
22
|
-
"sideEffects": false
|
|
1
|
+
{
|
|
2
|
+
"name": "croco-html",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": ">=13.3.11",
|
|
6
|
+
"@angular/core": ">=13.3.11",
|
|
7
|
+
"@angular/material": ">=13.3.9",
|
|
8
|
+
"@angular/cdk": ">=13.3.9",
|
|
9
|
+
"ngx-clipboard": ">=15.1.0",
|
|
10
|
+
"@ng-select/ng-select": ">=9.0.2"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tslib": ">=2.2.0"
|
|
14
|
+
}
|
|
23
15
|
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div [hidden]="true">
|
|
2
|
+
<app-upload-files-btn #fakeBtn
|
|
3
|
+
(onFilesUploaded)="filesUploadedHandler($event)"
|
|
4
|
+
[btnText]="'Добавить изображения'"
|
|
5
|
+
[createLocalCopiesNow]="true"
|
|
6
|
+
(postFilesStarted)="postFilesStartedEventHandler($event)"
|
|
7
|
+
[extAccepts]="'image/*'"></app-upload-files-btn>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<button class="w-100"
|
|
12
|
+
(click)="handleClick()"
|
|
13
|
+
mat-stroked-button>Добавить изображения</button>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { FileImageTagDataConsts } from '../../extensions/ImageMethods';
|
|
3
|
+
import { HtmlBodyTag } from '../../models/models';
|
|
4
|
+
import { BaseApiResponseWithFilesIds } from '../../services/file-upload.service';
|
|
5
|
+
import { FilePostingStarted, UploadFilesBtnComponent } from '../upload-files-btn/upload-files-btn.component';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'croco-add-files-btn',
|
|
9
|
+
templateUrl: './add-files-btn.component.html',
|
|
10
|
+
styleUrls: ['./add-files-btn.component.css']
|
|
11
|
+
})
|
|
12
|
+
export class AddFilesBtnComponent implements OnInit {
|
|
13
|
+
|
|
14
|
+
@Output()
|
|
15
|
+
postFilesStarted = new EventEmitter<FilePostingStarted>();
|
|
16
|
+
|
|
17
|
+
@ViewChild("fakeBtn")
|
|
18
|
+
fakeBtn!: UploadFilesBtnComponent;
|
|
19
|
+
|
|
20
|
+
fileIds:number[] = [];
|
|
21
|
+
|
|
22
|
+
constructor() { }
|
|
23
|
+
|
|
24
|
+
@Output()
|
|
25
|
+
filesTagsReady = new EventEmitter<HtmlBodyTag[]>();
|
|
26
|
+
|
|
27
|
+
postFilesStartedEventHandler(data: FilePostingStarted){
|
|
28
|
+
this.postFilesStarted.emit(data);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
filesUploadedHandler(data: BaseApiResponseWithFilesIds){
|
|
32
|
+
this.fileIds = data.responseObject;
|
|
33
|
+
|
|
34
|
+
let fileTags:HtmlBodyTag[] = [];
|
|
35
|
+
|
|
36
|
+
for(let i=0; i < this.fileIds.length; i++){
|
|
37
|
+
let fileTag: HtmlBodyTag = {
|
|
38
|
+
presentOrEdit: true,
|
|
39
|
+
tagDescription: {
|
|
40
|
+
tag: FileImageTagDataConsts.TagName,
|
|
41
|
+
displayValue: "Изображение"
|
|
42
|
+
},
|
|
43
|
+
attributes: {
|
|
44
|
+
[FileImageTagDataConsts.FileIdAttrName]: this.fileIds[i]
|
|
45
|
+
},
|
|
46
|
+
innerHtml: ""
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
fileTags.push(fileTag);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.filesTagsReady.emit(fileTags);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
handleClick(){
|
|
56
|
+
this.fakeBtn.clickFileInput();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngOnInit(): void {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div *ngIf="tag.presentOrEdit">
|
|
2
|
+
|
|
3
|
+
<div>
|
|
4
|
+
Ссылка на YouTube: {{data.youtubeLink}}
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div style="height: 10px;"></div>
|
|
8
|
+
|
|
9
|
+
<croco-html-xml-tag-external-video [tagData]="tagData">
|
|
10
|
+
</croco-html-xml-tag-external-video>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div *ngIf="!tag.presentOrEdit">
|
|
14
|
+
<div>
|
|
15
|
+
<form [formGroup]="myForm">
|
|
16
|
+
<mat-form-field class="w-100">
|
|
17
|
+
<input matInput placeholder="Ссылка на YouTube"
|
|
18
|
+
new-autocomplete="off"
|
|
19
|
+
autocomplete="off"
|
|
20
|
+
formControlName="youtubeLink"
|
|
21
|
+
[(ngModel)]="data.youtubeLink"
|
|
22
|
+
(ngModelChange)="linkChanged()">
|
|
23
|
+
</mat-form-field>
|
|
24
|
+
</form>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { ExternalVideoTagData, ExternalVideoSupportedTypes } from '../../../extensions/VideoMethods';
|
|
4
|
+
import { HtmlBodyTag } from '../../../models/models';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'croco-html-external-video-block',
|
|
8
|
+
templateUrl: './external-video-block.component.html',
|
|
9
|
+
styleUrls: ['./external-video-block.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class ExternalVideoBlockComponent implements OnInit {
|
|
12
|
+
|
|
13
|
+
@Input()
|
|
14
|
+
tag: HtmlBodyTag;
|
|
15
|
+
|
|
16
|
+
@Output()
|
|
17
|
+
onTagUpdated = new EventEmitter<HtmlBodyTag>();
|
|
18
|
+
|
|
19
|
+
myForm = new FormGroup({
|
|
20
|
+
youtubeLink: new FormControl()
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
defaultLink = "https://youtu.be/jzBneaWSswY";
|
|
24
|
+
|
|
25
|
+
data = {
|
|
26
|
+
youtubeLink: this.defaultLink
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
tagData: ExternalVideoTagData = {
|
|
30
|
+
link: this.defaultLink,
|
|
31
|
+
type: ExternalVideoSupportedTypes.Youtube
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
linkChanged(){
|
|
35
|
+
this.tagData.link = this.data.youtubeLink;
|
|
36
|
+
this.tag.attributes = this.tagData;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ngOnInit(): void {
|
|
40
|
+
this.linkChanged();
|
|
41
|
+
|
|
42
|
+
this.tagData = this.tag.attributes as ExternalVideoTagData;
|
|
43
|
+
this.data.youtubeLink = this.tagData.link;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div *ngIf="tag.presentOrEdit">
|
|
2
|
+
<div [innerHTML]="tag.innerHtml"></div>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div *ngIf="!tag.presentOrEdit">
|
|
6
|
+
<div style="height: 10px;">
|
|
7
|
+
</div>
|
|
8
|
+
<div>
|
|
9
|
+
<mat-form-field class="w-100">
|
|
10
|
+
<textarea matInput cdkTextareaAutosize #autosize="cdkTextareaAutosize"
|
|
11
|
+
cdkAutosizeMinRows="1"
|
|
12
|
+
placeholder="Внутренняя разметка тега"
|
|
13
|
+
[(ngModel)]="tag.innerHtml"></textarea>
|
|
14
|
+
</mat-form-field>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { HtmlBodyTag } from '../../../models/models';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'croco-html-html-raw-editor',
|
|
6
|
+
templateUrl: './html-raw-editor.component.html',
|
|
7
|
+
styleUrls: ['./html-raw-editor.component.css']
|
|
8
|
+
})
|
|
9
|
+
export class HtmlRawEditorComponent implements OnInit {
|
|
10
|
+
|
|
11
|
+
@Input()
|
|
12
|
+
tag: HtmlBodyTag;
|
|
13
|
+
|
|
14
|
+
@Output()
|
|
15
|
+
onTagUpdated = new EventEmitter<HtmlBodyTag>();
|
|
16
|
+
|
|
17
|
+
constructor() { }
|
|
18
|
+
|
|
19
|
+
ngOnInit(): void {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<div style="height: 10px;">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div *ngIf="hasImageError" class="error-block">
|
|
6
|
+
Изображение не найдено по указанному идентификатору, возможно файл не существует или отсутствует на сервере.
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div *ngIf="hasFileId() && !hasImageError">
|
|
10
|
+
<img class="mx-auto d-block img-fluid" [src]="getSrc()" (error)="onErrorHandler()"/>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div *ngIf="!hasFileId()">
|
|
14
|
+
<h5>[Изображение не выбрано]</h5>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div *ngIf="!tag.presentOrEdit">
|
|
19
|
+
<div style="height: 10px;"></div>
|
|
20
|
+
|
|
21
|
+
<div style="overflow-x:auto;">
|
|
22
|
+
<mat-button-toggle-group [(ngModel)]="searchOrEdit">
|
|
23
|
+
<mat-button-toggle value="search">
|
|
24
|
+
Искать файл <mat-icon>search</mat-icon>
|
|
25
|
+
</mat-button-toggle>
|
|
26
|
+
<mat-button-toggle value="edit">
|
|
27
|
+
Указать по идентификатору <mat-icon>settings</mat-icon>
|
|
28
|
+
</mat-button-toggle>
|
|
29
|
+
</mat-button-toggle-group>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<div style="height: 10px;"></div>
|
|
34
|
+
|
|
35
|
+
<div [hidden]="searchOrEdit !== 'search'">
|
|
36
|
+
<croco-html-file-id-select
|
|
37
|
+
[labelText]="'Выбрать файл'"
|
|
38
|
+
[(fileId)]="tag.attributes['file-id']"
|
|
39
|
+
(onFileIdChanged)="onFileIdChanged($event)">
|
|
40
|
+
</croco-html-file-id-select>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div [hidden]="searchOrEdit !== 'edit'">
|
|
44
|
+
<form [formGroup]="myForm">
|
|
45
|
+
<mat-form-field class="w-100">
|
|
46
|
+
<input matInput placeholder="Идентификатор файла" new-autocomplete="off" autocomplete="off"
|
|
47
|
+
formControlName="fileId"
|
|
48
|
+
type="number"
|
|
49
|
+
[(ngModel)]="tag.attributes['file-id']"
|
|
50
|
+
(ngModelChange)="removeImageError()">
|
|
51
|
+
</mat-form-field>
|
|
52
|
+
</form>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { ImageMethods, FileImageTagDataConsts } from '../../../extensions/ImageMethods';
|
|
4
|
+
import { HtmlBodyTag } from '../../../models/models';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'croco-html-image-editor',
|
|
8
|
+
templateUrl: './image-editor.component.html',
|
|
9
|
+
styleUrls: ['./image-editor.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class ImageEditorComponent implements OnInit {
|
|
12
|
+
|
|
13
|
+
hasImageError = false;
|
|
14
|
+
searchOrEdit = "search";
|
|
15
|
+
|
|
16
|
+
@Input()
|
|
17
|
+
tag: HtmlBodyTag;
|
|
18
|
+
|
|
19
|
+
myForm = new FormGroup({
|
|
20
|
+
fileId:new FormControl()
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
onErrorHandler(){
|
|
24
|
+
this.hasImageError = true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Output()
|
|
28
|
+
onTagUpdated = new EventEmitter<HtmlBodyTag>();
|
|
29
|
+
|
|
30
|
+
constructor() { }
|
|
31
|
+
|
|
32
|
+
getSrc(){
|
|
33
|
+
return ImageMethods.buildUrl(this.tag.attributes[FileImageTagDataConsts.FileIdAttrName]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
hasFileId(){
|
|
37
|
+
return this.tag.attributes.hasOwnProperty(FileImageTagDataConsts.FileIdAttrName) && !isNaN(this.tag.attributes[FileImageTagDataConsts.FileIdAttrName]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onFileIdChanged(fileId:number){
|
|
41
|
+
this.tag.attributes[FileImageTagDataConsts.FileIdAttrName] = fileId;
|
|
42
|
+
this.removeImageError();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
removeImageError(){
|
|
46
|
+
this.hasImageError = false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ngOnInit(): void {
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './external-video-block/external-video-block.component'
|
|
2
|
+
export * from './html-raw-editor/html-raw-editor.component'
|
|
3
|
+
export * from './image-editor/image-editor.component'
|
|
4
|
+
export * from './main-editor/main-editor.component'
|
|
5
|
+
export * from './main-editor-block/main-editor-block.component'
|
|
6
|
+
export * from './text-editor/text-editor.component'
|
|
7
|
+
export * from './visual-editor/visual-editor.component'
|
|
@@ -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,39 @@
|
|
|
1
|
+
<mat-tab-group>
|
|
2
|
+
<mat-tab label="Визуальный редактор">
|
|
3
|
+
|
|
4
|
+
<div style="height: 20px;"></div>
|
|
5
|
+
|
|
6
|
+
<croco-visual-editor #visualEditor
|
|
7
|
+
[useHtmlRaw]="useHtmlRaw"
|
|
8
|
+
[html]="html"
|
|
9
|
+
(onHtmlChanged)="onHtmlChangedHandler($event)"
|
|
10
|
+
(rendered)="visualEditorRenderedHandler()">
|
|
11
|
+
</croco-visual-editor>
|
|
12
|
+
|
|
13
|
+
<div style="height: 20px;"></div>
|
|
14
|
+
|
|
15
|
+
</mat-tab>
|
|
16
|
+
|
|
17
|
+
<mat-tab label="Разметка">
|
|
18
|
+
<div style="height: 10px;"></div>
|
|
19
|
+
<form *ngIf="visualEditorRendered" [formGroup]="myForm">
|
|
20
|
+
<mat-form-field class="w-100">
|
|
21
|
+
<textarea matInput cdkTextareaAutosize #autosize="cdkTextareaAutosize"
|
|
22
|
+
cdkAutosizeMinRows="1"
|
|
23
|
+
placeholder="Исходный код" formControlName="html" [(ngModel)]="html"
|
|
24
|
+
(ngModelChange)="textAreaModelChangedHandler()"></textarea>
|
|
25
|
+
</mat-form-field>
|
|
26
|
+
</form>
|
|
27
|
+
|
|
28
|
+
<button (click)="copyMarkUp()"
|
|
29
|
+
mat-raised-button color="primary">
|
|
30
|
+
Копировать разметку
|
|
31
|
+
</button>
|
|
32
|
+
</mat-tab>
|
|
33
|
+
<mat-tab label="Результат">
|
|
34
|
+
<mat-card>
|
|
35
|
+
<croco-html-xml-tag-view [data]="html | topreview">
|
|
36
|
+
</croco-html-xml-tag-view>
|
|
37
|
+
</mat-card>
|
|
38
|
+
</mat-tab>
|
|
39
|
+
</mat-tab-group>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AfterContentChecked, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
+
import { ClipboardService } from 'ngx-clipboard';
|
|
5
|
+
import { VisualEditorComponent } from '../visual-editor/visual-editor.component';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'croco-html-main-editor',
|
|
9
|
+
templateUrl: './main-editor.component.html',
|
|
10
|
+
styleUrls: ['./main-editor.component.css']
|
|
11
|
+
})
|
|
12
|
+
export class MainEditorComponent implements OnInit, AfterContentChecked {
|
|
13
|
+
|
|
14
|
+
visualEditorRendered = false;
|
|
15
|
+
@ViewChild("visualEditor")
|
|
16
|
+
visualEditor!: VisualEditorComponent;
|
|
17
|
+
|
|
18
|
+
@Input()
|
|
19
|
+
showMarkUp = true;
|
|
20
|
+
|
|
21
|
+
@Input()
|
|
22
|
+
useHtmlRaw = false;
|
|
23
|
+
|
|
24
|
+
myForm = new FormGroup({
|
|
25
|
+
"html": new FormControl(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
@Input()
|
|
29
|
+
@Output()
|
|
30
|
+
html: string = "";
|
|
31
|
+
|
|
32
|
+
@Output()
|
|
33
|
+
onHtmlChanged = new EventEmitter<string>();
|
|
34
|
+
|
|
35
|
+
constructor(private _clipboardService: ClipboardService,
|
|
36
|
+
private _snackBar: MatSnackBar,
|
|
37
|
+
private _cdref: ChangeDetectorRef) { }
|
|
38
|
+
|
|
39
|
+
ngAfterContentChecked(): void {
|
|
40
|
+
this._cdref.detectChanges();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
visualEditorRenderedHandler(){
|
|
44
|
+
this.visualEditorRendered = true;
|
|
45
|
+
this.recalculateBodyTags();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onHtmlChangedHandler(html: string) {
|
|
49
|
+
this.html = html;
|
|
50
|
+
this.onHtmlChanged.emit(html);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
textAreaModelChangedHandler(){
|
|
54
|
+
this.recalculateBodyTags();
|
|
55
|
+
this.onHtmlChangedHandler(this.html);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
recalculateBodyTags() {
|
|
59
|
+
this.visualEditor.html = this.html;
|
|
60
|
+
this.visualEditor.recalculateBodyTags();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
copyMarkUp() {
|
|
64
|
+
this._snackBar.open("Разметка таблицы скопирована в буфер обмена", "Закрыть", { duration: 1500 });
|
|
65
|
+
this._clipboardService.copy(this.html);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ngOnInit(): void {
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
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>
|