croco-html 4.3.4 → 4.3.6
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/fesm2022/croco-html.mjs +30 -12
- package/fesm2022/croco-html.mjs.map +1 -1
- package/lib/components/editor/index.d.ts +1 -0
- package/lib/components/editor/main-editor-block/components/defined-custom-editor-block/defined-custom-editor-block.component.d.ts +9 -0
- package/lib/extensions/BodyTagsExtensions.d.ts +2 -2
- package/package.json +1 -1
package/fesm2022/croco-html.mjs
CHANGED
|
@@ -988,7 +988,7 @@ class TableTagService {
|
|
|
988
988
|
}
|
|
989
989
|
|
|
990
990
|
class BodyTagsExtensions {
|
|
991
|
-
static { this.
|
|
991
|
+
static { this._tagServices = {
|
|
992
992
|
[TextTags.text]: new TextTagHtmlMarkupTagService("text", "T"),
|
|
993
993
|
[TextTags.h1]: new TextTagHtmlMarkupTagService("h1", "H1"),
|
|
994
994
|
[TextTags.h2]: new TextTagHtmlMarkupTagService("h2", "H2"),
|
|
@@ -1004,7 +1004,7 @@ class BodyTagsExtensions {
|
|
|
1004
1004
|
[TableTypes.Table]: new TableTagService()
|
|
1005
1005
|
}; }
|
|
1006
1006
|
static hasTagService(tagName, options) {
|
|
1007
|
-
if (this.
|
|
1007
|
+
if (this._tagServices.hasOwnProperty(tagName)) {
|
|
1008
1008
|
return true;
|
|
1009
1009
|
}
|
|
1010
1010
|
if (options.definedCustomTags.hasOwnProperty(tagName)) {
|
|
@@ -1013,8 +1013,8 @@ class BodyTagsExtensions {
|
|
|
1013
1013
|
return false;
|
|
1014
1014
|
}
|
|
1015
1015
|
static getTagService(tagName, options) {
|
|
1016
|
-
if (this.
|
|
1017
|
-
return this.
|
|
1016
|
+
if (this._tagServices.hasOwnProperty(tagName)) {
|
|
1017
|
+
return this._tagServices[tagName];
|
|
1018
1018
|
}
|
|
1019
1019
|
return options.definedCustomTags[tagName];
|
|
1020
1020
|
}
|
|
@@ -1037,14 +1037,15 @@ class BodyTagsExtensions {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
static getBodyTags(html, options) {
|
|
1039
1039
|
let result = HtmlExtractionMethods.transformHtmlStringToBlocks(html, options);
|
|
1040
|
-
return result.map(x => BodyTagsExtensions.toBodyTag(x));
|
|
1040
|
+
return result.map(x => BodyTagsExtensions.toBodyTag(x, options));
|
|
1041
1041
|
}
|
|
1042
1042
|
static sanitizeInnerHtml(html) {
|
|
1043
1043
|
return html.trim().replace('\n\t', '');
|
|
1044
1044
|
}
|
|
1045
|
-
static toBodyTag(data) {
|
|
1046
|
-
|
|
1047
|
-
|
|
1045
|
+
static toBodyTag(data, options) {
|
|
1046
|
+
const tagName = data.tagName;
|
|
1047
|
+
if (this.hasTagService(tagName, options)) {
|
|
1048
|
+
return this.getTagService(tagName, options).toBodyTag(data);
|
|
1048
1049
|
}
|
|
1049
1050
|
return {
|
|
1050
1051
|
presentOrEdit: true,
|
|
@@ -1885,11 +1886,11 @@ class HtmlRawEditorComponent {
|
|
|
1885
1886
|
this.safeHtml = this._sanitizer.bypassSecurityTrustHtml(this.tag.innerHtml);
|
|
1886
1887
|
}
|
|
1887
1888
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HtmlRawEditorComponent, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1888
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: HtmlRawEditorComponent, isStandalone: true, selector: "croco-html-html-raw-editor", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, usesOnChanges: true, ngImport: i0, template: "@if (tag.presentOrEdit) {\n <div [innerHTML]=\"safeHtml\">\n </div>\n}\n@
|
|
1889
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: HtmlRawEditorComponent, isStandalone: true, selector: "croco-html-html-raw-editor", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, usesOnChanges: true, ngImport: i0, template: "@if (tag.presentOrEdit) {\n <div [innerHTML]=\"safeHtml\">\n </div>\n}\n@else {\n <div>\n <div style=\"height: 10px;\">\n </div>\n <div>\n <mat-form-field class=\"w-100\">\n <mat-label>\n \u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u0433\u0430\n </mat-label>\n <textarea matInput cdkTextareaAutosize #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n placeholder=\"\u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u0433\u0430\"\n [(ngModel)]=\"tag.innerHtml\"\n (ngModelChange)=\"onSafeHtmlChange()\"\n ></textarea>\n </mat-form-field>\n </div>\n </div>\n}\n\n", styles: [".code-view.video-player{margin:0 auto;max-width:640px;width:100%;height:360px}.code-view.use-responsive ::ng-deep iframe{width:100%;height:100%}@media screen and (max-width: 768px){.code-view.use-responsive{height:300px}}@media screen and (max-width: 575px){.code-view.use-responsive{height:250px}}@media screen and (max-width: 480px){.code-view.use-responsive{height:200px}}@media screen and (max-width: 380px){.code-view.use-responsive{height:180px}}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1889
1890
|
}
|
|
1890
1891
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HtmlRawEditorComponent, decorators: [{
|
|
1891
1892
|
type: Component,
|
|
1892
|
-
args: [{ selector: 'croco-html-html-raw-editor', standalone: true, imports: [MatFormField, MatLabel, MatInput, CdkTextareaAutosize, FormsModule], template: "@if (tag.presentOrEdit) {\n <div [innerHTML]=\"safeHtml\">\n </div>\n}\n@
|
|
1893
|
+
args: [{ selector: 'croco-html-html-raw-editor', standalone: true, imports: [MatFormField, MatLabel, MatInput, CdkTextareaAutosize, FormsModule], template: "@if (tag.presentOrEdit) {\n <div [innerHTML]=\"safeHtml\">\n </div>\n}\n@else {\n <div>\n <div style=\"height: 10px;\">\n </div>\n <div>\n <mat-form-field class=\"w-100\">\n <mat-label>\n \u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u0433\u0430\n </mat-label>\n <textarea matInput cdkTextareaAutosize #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n placeholder=\"\u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u044F\u044F \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0430 \u0442\u0435\u0433\u0430\"\n [(ngModel)]=\"tag.innerHtml\"\n (ngModelChange)=\"onSafeHtmlChange()\"\n ></textarea>\n </mat-form-field>\n </div>\n </div>\n}\n\n", styles: [".code-view.video-player{margin:0 auto;max-width:640px;width:100%;height:360px}.code-view.use-responsive ::ng-deep iframe{width:100%;height:100%}@media screen and (max-width: 768px){.code-view.use-responsive{height:300px}}@media screen and (max-width: 575px){.code-view.use-responsive{height:250px}}@media screen and (max-width: 480px){.code-view.use-responsive{height:200px}}@media screen and (max-width: 380px){.code-view.use-responsive{height:180px}}\n"] }]
|
|
1893
1894
|
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }], propDecorators: { tag: [{
|
|
1894
1895
|
type: Input
|
|
1895
1896
|
}], onTagUpdated: [{
|
|
@@ -2282,10 +2283,10 @@ class MainEditorBlockComponent {
|
|
|
2282
2283
|
this.onTagSaved.emit(this.tag);
|
|
2283
2284
|
}
|
|
2284
2285
|
isDefinedCustomTag() {
|
|
2285
|
-
console.log("isDefinedCustomTag()", this.tag, this._options);
|
|
2286
2286
|
if (this._options.definedCustomTags.hasOwnProperty(this.tag.tagDescription.tag)) {
|
|
2287
2287
|
return true;
|
|
2288
2288
|
}
|
|
2289
|
+
console.log("isDefinedCustomTag", this.tag);
|
|
2289
2290
|
return false;
|
|
2290
2291
|
}
|
|
2291
2292
|
deleteItem() {
|
|
@@ -2708,6 +2709,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2708
2709
|
type: Output
|
|
2709
2710
|
}] } });
|
|
2710
2711
|
|
|
2712
|
+
class DefinedCustomEditorBlockComponent {
|
|
2713
|
+
constructor() {
|
|
2714
|
+
this.onTagUpdated = new EventEmitter();
|
|
2715
|
+
}
|
|
2716
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomEditorBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2717
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DefinedCustomEditorBlockComponent, isStandalone: true, selector: "croco-html-defined-custom-editor-block", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, ngImport: i0, template: "<div>\n {{tag | json}}\n</div>\n<div>\n TODO \u0441\u044E\u0434\u0430 \u043D\u0430\u0434\u043E \u043F\u0440\u043E\u043A\u0438\u043D\u0443\u0442\u044C \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440 \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0438 \u0438\u0437 \u0432\u043D\u0435.\n</div>", styles: [""], dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }] }); }
|
|
2718
|
+
}
|
|
2719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomEditorBlockComponent, decorators: [{
|
|
2720
|
+
type: Component,
|
|
2721
|
+
args: [{ selector: 'croco-html-defined-custom-editor-block', imports: [JsonPipe], template: "<div>\n {{tag | json}}\n</div>\n<div>\n TODO \u0441\u044E\u0434\u0430 \u043D\u0430\u0434\u043E \u043F\u0440\u043E\u043A\u0438\u043D\u0443\u0442\u044C \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440 \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0438 \u0438\u0437 \u0432\u043D\u0435.\n</div>" }]
|
|
2722
|
+
}], propDecorators: { tag: [{
|
|
2723
|
+
type: Input,
|
|
2724
|
+
args: [{ required: true }]
|
|
2725
|
+
}], onTagUpdated: [{
|
|
2726
|
+
type: Output
|
|
2727
|
+
}] } });
|
|
2728
|
+
|
|
2711
2729
|
class TagToSpanPipe {
|
|
2712
2730
|
transform(value) {
|
|
2713
2731
|
return value.map(x => (`<b>${x}</b>`)).join(' | ');
|
|
@@ -2880,5 +2898,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2880
2898
|
* Generated bundle index. Do not edit.
|
|
2881
2899
|
*/
|
|
2882
2900
|
|
|
2883
|
-
export { AddFilesBtnComponent, AngularMaterialTableMethods, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, MainEditorBlockComponent, MainEditorComponent, TableBuilder, TableMethods, TableTypes, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
|
|
2901
|
+
export { AddFilesBtnComponent, AngularMaterialTableMethods, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomEditorBlockComponent, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, MainEditorBlockComponent, MainEditorComponent, TableBuilder, TableMethods, TableTypes, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
|
|
2884
2902
|
//# sourceMappingURL=croco-html.mjs.map
|