croco-html 20.3.2 → 20.3.4

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.
@@ -686,6 +686,27 @@ class CustomWidgetTagService {
686
686
  }
687
687
  }
688
688
 
689
+ class TagBuildExtensions {
690
+ static buildTagString(bodyTag, attrs) {
691
+ const tagName = bodyTag.tagDescription.tag;
692
+ const attrValStrs = [];
693
+ Object.keys(attrs).forEach(attributeName => {
694
+ const attrDescription = attrs[attributeName];
695
+ const attrVal = bodyTag.attributes[attributeName] ?? attrDescription.defaultValue;
696
+ const attrValStr = (attrVal === undefined || attrVal === null)
697
+ ? null
698
+ : `${attributeName}="${attrVal}"`;
699
+ if (attrValStr) {
700
+ attrValStrs.push(attrValStr);
701
+ }
702
+ });
703
+ const attrStr = attrValStrs.length > 0
704
+ ? " " + [attrValStrs].join(" ")
705
+ : "";
706
+ return `<${tagName}${attrStr}></${tagName}>`;
707
+ }
708
+ }
709
+
689
710
  class LinkTagConsts {
690
711
  static { this.TagName = "croco-link"; }
691
712
  }
@@ -701,14 +722,11 @@ class LinkTagService {
701
722
  this.shortDescription = "Ссылка";
702
723
  }
703
724
  bodyTagToHtmlStringConverter(bodyTag) {
704
- const urlVal = bodyTag.attributes[LinkTagAttrs.Url] ?? "";
705
- const urlValStr = `${LinkTagAttrs.Url}="${urlVal}"`;
706
- const titleVal = bodyTag.attributes[LinkTagAttrs.Title] ?? "";
707
- const titleValStr = `${LinkTagAttrs.Title}="${titleVal}"`;
708
- const typeVal = bodyTag.attributes[LinkTagAttrs.Type] ?? "";
709
- const typeValStr = typeVal.length > 0 ? `${LinkTagAttrs.Type}="${typeVal}"` : "";
710
- const attrStr = [urlValStr, titleValStr, typeValStr].join(" ");
711
- return `<${this.tagName} ${attrStr}></${this.tagName}>`;
725
+ return TagBuildExtensions.buildTagString(bodyTag, {
726
+ [LinkTagAttrs.Url]: { defaultValue: "" },
727
+ [LinkTagAttrs.Title]: { defaultValue: "" },
728
+ [LinkTagAttrs.Type]: { defaultValue: null }
729
+ });
712
730
  }
713
731
  extractBlockFromHtmlElement(elem, _) {
714
732
  const data = {
@@ -3430,13 +3448,10 @@ class MainEditorBlockComponent {
3430
3448
  this._tagService.presentOrEdit$.next(false);
3431
3449
  }
3432
3450
  isEditorDefined() {
3433
- if (this.tag === null || this.tag === undefined) {
3434
- return false;
3435
- }
3436
- return DefaultTags.isEditorDefined(this.tag, this._options);
3451
+ return DefaultTags.isEditorDefined(this._tag, this._options);
3437
3452
  }
3438
3453
  deleteItem() {
3439
- this.onTagRemoved.emit(this.tag);
3454
+ this.onTagRemoved.emit(this._tag);
3440
3455
  }
3441
3456
  ngOnDestroy() {
3442
3457
  this.unsubscribe.next();
@@ -4204,5 +4219,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
4204
4219
  * Generated bundle index. Do not edit.
4205
4220
  */
4206
4221
 
4207
- export { AddFilesBtnComponent, AngularMaterialTableMethods, AudioEditorComponent, AudioMethods, AudioPlayerTagViewComponent, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetIconComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomEditorBlockComponent, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileAudioTagDataConsts, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlPageDataController, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, LinkEditorComponent, LinkTagAttrs, LinkTagConsts, LinkTagService, MainEditorBlockComponent, MainEditorComponent, TableBuilder, TableMethods, TableTypes, TagEditorService, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
4222
+ export { AddFilesBtnComponent, AngularMaterialTableMethods, AudioEditorComponent, AudioMethods, AudioPlayerTagViewComponent, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetIconComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomEditorBlockComponent, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileAudioTagDataConsts, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlPageDataController, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, LinkEditorComponent, LinkTagAttrs, LinkTagConsts, LinkTagService, MainEditorBlockComponent, MainEditorComponent, TableBuilder, TableMethods, TableTypes, TagBuildExtensions, TagEditorService, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
4208
4223
  //# sourceMappingURL=croco-html.mjs.map