croco-html 4.3.2 → 4.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.
@@ -269,9 +269,9 @@ class FileImageTagService {
269
269
  fileIdAttr = `${FileImageTagDataConsts.FileIdAttrName}="${bodyTag.attributes[FileImageTagDataConsts.FileIdAttrName]}"`;
270
270
  }
271
271
  if (bodyTag.attributes.hasOwnProperty(FileImageTagDataConsts.ScreenMediaRequest) && bodyTag.attributes[FileImageTagDataConsts.ScreenMediaRequest]) {
272
- screenMediaRequestAttr = `${FileImageTagDataConsts.ScreenMediaRequest}="${bodyTag.attributes[FileImageTagDataConsts.ScreenMediaRequest]}"`;
272
+ screenMediaRequestAttr = ` ${FileImageTagDataConsts.ScreenMediaRequest}="${bodyTag.attributes[FileImageTagDataConsts.ScreenMediaRequest]}"`;
273
273
  }
274
- return `<${FileImageTagDataConsts.TagName} ${fileIdAttr} ${screenMediaRequestAttr}></${FileImageTagDataConsts.TagName}>`;
274
+ return `<${FileImageTagDataConsts.TagName} ${fileIdAttr}${screenMediaRequestAttr}></${FileImageTagDataConsts.TagName}>`;
275
275
  }
276
276
  extractBlockFromHtmlElement(elem, options) {
277
277
  let fileId = elem.getAttribute(FileImageTagDataConsts.FileIdAttrName);
@@ -1018,15 +1018,16 @@ class BodyTagsExtensions {
1018
1018
  }
1019
1019
  return options.definedCustomTags[tagName];
1020
1020
  }
1021
- static convertToHtmlString(bodyTag) {
1022
- const tagName = bodyTag.tagDescription.tag;
1023
- if (this.tagServices.hasOwnProperty(tagName)) {
1024
- return this.tagServices[tagName].bodyTagToHtmlStringConverter(bodyTag);
1021
+ static convertToHtmlString(bodyTag, options) {
1022
+ const tagName = bodyTag.tagDescription.tag.toLowerCase();
1023
+ if (this.hasTagService(tagName, options)) {
1024
+ return this.getTagService(tagName, options).bodyTagToHtmlStringConverter(bodyTag);
1025
1025
  }
1026
- return `<mapper-not-found>"${bodyTag.tagDescription.tag}" тег не найден.</mapper-not-found>`;
1026
+ console.log("convertToHtmlString", bodyTag, options);
1027
+ return `<mapper-not-found>"${tagName}" тег не найден.</mapper-not-found>`;
1027
1028
  }
1028
- static bodyTagsToHtml(bodyTags) {
1029
- let htmls = bodyTags.map(bodyTag => (BodyTagsExtensions.convertToHtmlString(bodyTag)));
1029
+ static bodyTagsToHtml(bodyTags, options) {
1030
+ let htmls = bodyTags.map(bodyTag => (BodyTagsExtensions.convertToHtmlString(bodyTag, options)));
1030
1031
  let result = "";
1031
1032
  for (let index = 0; index < htmls.length; index++) {
1032
1033
  const element = htmls[index];
@@ -2281,7 +2282,7 @@ class MainEditorBlockComponent {
2281
2282
  this.onTagSaved.emit(this.tag);
2282
2283
  }
2283
2284
  isDefinedCustomTag() {
2284
- console.log("isDefinedCustomTag()", this._options);
2285
+ console.log("isDefinedCustomTag()", this.tag, this._options);
2285
2286
  if (this._options.definedCustomTags.hasOwnProperty(this.tag.tagDescription.tag)) {
2286
2287
  return true;
2287
2288
  }
@@ -2460,7 +2461,7 @@ class VisualEditorComponent {
2460
2461
  this.recalculateHtml();
2461
2462
  }
2462
2463
  recalculateHtml() {
2463
- let result = BodyTagsExtensions.bodyTagsToHtml(this.bodyTags);
2464
+ let result = BodyTagsExtensions.bodyTagsToHtml(this.bodyTags, this._options);
2464
2465
  this.html = XmlExtensions.formatXml("<body>" + result + "</body>");
2465
2466
  this.onHtmlChanged.emit(this.html);
2466
2467
  }