croco-html 20.2.0 → 20.2.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.
@@ -684,6 +684,77 @@ class CustomWidgetTagService {
684
684
  }
685
685
  }
686
686
 
687
+ class LinkTagConsts {
688
+ static { this.TagName = "croco-link"; }
689
+ }
690
+ class LinkTagAttrs {
691
+ static { this.FileId = "file-id"; }
692
+ static { this.Url = "url"; }
693
+ static { this.Title = "title"; }
694
+ static { this.Type = "type"; }
695
+ }
696
+ class LinkTagService {
697
+ constructor() {
698
+ this.tagName = LinkTagConsts.TagName;
699
+ this.shortDescription = "Ссылка";
700
+ }
701
+ bodyTagToHtmlStringConverter(bodyTag) {
702
+ const urlVal = bodyTag.attributes[LinkTagAttrs.Url] ?? "";
703
+ const urlValStr = `${LinkTagAttrs.Url}="${urlVal}"`;
704
+ const titleVal = bodyTag.attributes[LinkTagAttrs.Title] ?? "";
705
+ const titleValStr = `${LinkTagAttrs.Title}="${titleVal}"`;
706
+ const typeVal = bodyTag.attributes[LinkTagAttrs.Type] ?? "";
707
+ const typeValStr = typeVal.length > 0 ? `${LinkTagAttrs.Type}="${typeVal}"` : "";
708
+ const attrStr = [urlValStr, titleValStr, typeValStr].join(" ");
709
+ return `<${this.tagName} ${attrStr}></${this.tagName}>`;
710
+ }
711
+ extractBlockFromHtmlElement(elem, _) {
712
+ const data = {
713
+ url: elem.getAttribute(LinkTagAttrs.Url),
714
+ title: elem.getAttribute(LinkTagAttrs.Title),
715
+ type: elem.getAttribute(LinkTagAttrs.Type),
716
+ fileId: elem.getAttribute(LinkTagAttrs.FileId),
717
+ };
718
+ return {
719
+ tagName: this.tagName,
720
+ data
721
+ };
722
+ }
723
+ toBodyTag(data) {
724
+ let tagData = data.data;
725
+ const attrs = {
726
+ [LinkTagAttrs.Url]: tagData.url,
727
+ [LinkTagAttrs.Type]: tagData.type,
728
+ [LinkTagAttrs.FileId]: tagData.fileId,
729
+ [LinkTagAttrs.Title]: tagData.title
730
+ };
731
+ return {
732
+ tagDescription: {
733
+ tag: data.tagName,
734
+ displayValue: this.shortDescription,
735
+ isCustom: false
736
+ },
737
+ attributes: attrs,
738
+ innerHtml: ""
739
+ };
740
+ }
741
+ getDefaultValue(props) {
742
+ return {
743
+ tagDescription: {
744
+ tag: this.tagName,
745
+ displayValue: this.shortDescription,
746
+ isCustom: false
747
+ },
748
+ attributes: {
749
+ [LinkTagAttrs.Title]: 'Презентация',
750
+ [LinkTagAttrs.Url]: 'https://storage.yandexcloud.net/mega-academy/presentation.pdf',
751
+ [LinkTagAttrs.Type]: 'pdf'
752
+ },
753
+ innerHtml: props.htmlRaw,
754
+ };
755
+ }
756
+ }
757
+
687
758
  class TextTags {
688
759
  static { this.text = "text"; }
689
760
  static { this.h1 = "h1"; }
@@ -1087,77 +1158,6 @@ class TableTagService {
1087
1158
  }
1088
1159
  }
1089
1160
 
1090
- class LinkTagConsts {
1091
- static { this.TagName = "croco-link"; }
1092
- }
1093
- class LinkTagAttrs {
1094
- static { this.FileId = "file-id"; }
1095
- static { this.Url = "url"; }
1096
- static { this.Title = "title"; }
1097
- static { this.Type = "type"; }
1098
- }
1099
- class LinkTagService {
1100
- constructor() {
1101
- this.tagName = LinkTagConsts.TagName;
1102
- this.shortDescription = "Ссылка";
1103
- }
1104
- bodyTagToHtmlStringConverter(bodyTag) {
1105
- const urlVal = bodyTag.attributes[LinkTagAttrs.Url] ?? "";
1106
- const urlValStr = `${LinkTagAttrs.Url}="${urlVal}"`;
1107
- const titleVal = bodyTag.attributes[LinkTagAttrs.Title] ?? "";
1108
- const titleValStr = `${LinkTagAttrs.Title}="${titleVal}"`;
1109
- const typeVal = bodyTag.attributes[LinkTagAttrs.Type] ?? "";
1110
- const typeValStr = typeVal.length > 0 ? `${LinkTagAttrs.Type}="${typeVal}"` : "";
1111
- const attrStr = [urlValStr, titleValStr, typeValStr].join(" ");
1112
- return `<${this.tagName} ${attrStr}></${this.tagName}>`;
1113
- }
1114
- extractBlockFromHtmlElement(elem, _) {
1115
- const data = {
1116
- url: elem.getAttribute(LinkTagAttrs.Url),
1117
- title: elem.getAttribute(LinkTagAttrs.Title),
1118
- type: elem.getAttribute(LinkTagAttrs.Type),
1119
- fileId: elem.getAttribute(LinkTagAttrs.FileId),
1120
- };
1121
- return {
1122
- tagName: this.tagName,
1123
- data
1124
- };
1125
- }
1126
- toBodyTag(data) {
1127
- let tagData = data.data;
1128
- const attrs = {
1129
- [LinkTagAttrs.Url]: tagData.url,
1130
- [LinkTagAttrs.Type]: tagData.type,
1131
- [LinkTagAttrs.FileId]: tagData.fileId,
1132
- [LinkTagAttrs.Title]: tagData.title
1133
- };
1134
- return {
1135
- tagDescription: {
1136
- tag: data.tagName,
1137
- displayValue: this.shortDescription,
1138
- isCustom: false
1139
- },
1140
- attributes: attrs,
1141
- innerHtml: ""
1142
- };
1143
- }
1144
- getDefaultValue(props) {
1145
- return {
1146
- tagDescription: {
1147
- tag: this.tagName,
1148
- displayValue: this.shortDescription,
1149
- isCustom: false
1150
- },
1151
- attributes: {
1152
- [LinkTagAttrs.Title]: 'Презентация',
1153
- [LinkTagAttrs.Url]: 'https://storage.yandexcloud.net/mega-academy/presentation.pdf',
1154
- [LinkTagAttrs.Type]: 'pdf'
1155
- },
1156
- innerHtml: props.htmlRaw,
1157
- };
1158
- }
1159
- }
1160
-
1161
1161
  class BodyTagsExtensions {
1162
1162
  static { this._tagServices = {
1163
1163
  [TextTags.text]: new TextTagHtmlMarkupTagService("text", "T"),
@@ -4049,5 +4049,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
4049
4049
  * Generated bundle index. Do not edit.
4050
4050
  */
4051
4051
 
4052
- 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, 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 };
4052
+ 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, 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 };
4053
4053
  //# sourceMappingURL=croco-html.mjs.map