@contentstack/utils
Advanced tools
Comparing version 1.1.1 to 1.1.2
# Changelog | ||
## [1.1.1](https://github.com/contentstack/contentstack-utils-javascript/tree/v1.1.1) (2021-12-08) | ||
- Default render option for new tags | ||
## [1.1.0](https://github.com/contentstack/contentstack-utils-javascript/tree/v1.1.0) (2021-10-19) | ||
@@ -7,0 +4,0 @@ - Live preview edit tags support added |
@@ -37,7 +37,7 @@ 'use strict'; | ||
if (isFirst_1) { | ||
elementString_1 += "" + value; | ||
elementString_1 += "".concat(value); | ||
isFirst_1 = false; | ||
} | ||
else { | ||
elementString_1 += ", " + value; | ||
elementString_1 += ", ".concat(value); | ||
} | ||
@@ -52,3 +52,3 @@ }); | ||
var value = element[elementKey]; | ||
elementString += elementKey + ":" + value + "; "; | ||
elementString += "".concat(elementKey, ":").concat(value, "; "); | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
} | ||
result += " " + key + "=\"" + element + "\""; | ||
result += " ".concat(key, "=\"").concat(element, "\""); | ||
} | ||
@@ -139,3 +139,3 @@ }; | ||
String.prototype.forEachEmbeddedItem = function (callbackfn) { | ||
var str = "<" + frameflag + ">" + this.toString() + "</" + frameflag + ">"; | ||
var str = "<".concat(frameflag, ">").concat(this.toString(), "</").concat(frameflag, ">"); | ||
var root = nodeHtmlParser.parse(str); | ||
@@ -152,13 +152,13 @@ var embeddedEntries = root.querySelectorAll(".embedded-entry"); | ||
var _a; | ||
var defaultOptions = (_a = {}, | ||
_a[StyleType$1.BLOCK] = function (item) { | ||
return "<div><p>" + (item.title || item.uid) + "</p><p>Content type: <span>" + (item._content_type_uid || (item.system ? item.system.content_type_uid : '')) + "</span></p></div>"; | ||
var _a$1; | ||
var defaultOptions = (_a$1 = {}, | ||
_a$1[StyleType$1.BLOCK] = function (item) { | ||
return "<div><p>".concat(item.title || item.uid, "</p><p>Content type: <span>").concat(item._content_type_uid || (item.system ? item.system.content_type_uid : ''), "</span></p></div>"); | ||
}, | ||
_a[StyleType$1.INLINE] = function (item) { return "<span>" + (item.title || item.uid) + "</span>"; }, | ||
_a[StyleType$1.LINK] = function (item, metadata) { return "<a href=\"" + item.url + "\">" + (metadata.text || item.title || item.uid || (item.system ? item.system.uid : '')) + "</a>"; }, | ||
_a[StyleType$1.DISPLAY] = function (item, metadata) { return "<img src=\"" + item.url + "\" alt=\"" + (metadata.attributes.alt || item.title || item.filename || item.uid | ||
|| (item.system ? item.system.uid : '')) + "\" />"; }, | ||
_a[StyleType$1.DOWNLOAD] = function (item, metadata) { return "<a href=\"" + item.url + "\">" + (metadata.text || item.title || item.uid || (item.system ? item.system.content_type_uid : '')) + "</a>"; }, | ||
_a); | ||
_a$1[StyleType$1.INLINE] = function (item) { return "<span>".concat(item.title || item.uid, "</span>"); }, | ||
_a$1[StyleType$1.LINK] = function (item, metadata) { return "<a href=\"".concat(item.url, "\">").concat(metadata.text || item.title || item.uid || (item.system ? item.system.uid : ''), "</a>"); }, | ||
_a$1[StyleType$1.DISPLAY] = function (item, metadata) { return "<img src=\"".concat(item.url, "\" alt=\"").concat(metadata.attributes.alt || item.title || item.filename || item.uid | ||
|| (item.system ? item.system.uid : ''), "\" />"); }, | ||
_a$1[StyleType$1.DOWNLOAD] = function (item, metadata) { return "<a href=\"".concat(item.url, "\">").concat(metadata.text || item.title || item.uid || (item.system ? item.system.content_type_uid : ''), "</a>"); }, | ||
_a$1); | ||
@@ -395,104 +395,104 @@ // This function will find Embedded object present in string | ||
var _a$1; | ||
var defaultNodeOption = (_a$1 = {}, | ||
_a$1[NodeType$1.DOCUMENT] = function (node) { | ||
var _a; | ||
var defaultNodeOption = (_a = {}, | ||
_a[NodeType$1.DOCUMENT] = function (node) { | ||
return ""; | ||
}, | ||
_a$1[NodeType$1.PARAGRAPH] = function (node, next) { | ||
return "<p>" + next(node.children) + "</p>"; | ||
_a[NodeType$1.PARAGRAPH] = function (node, next) { | ||
return "<p>".concat(next(node.children), "</p>"); | ||
}, | ||
_a$1[NodeType$1.LINK] = function (node, next) { | ||
return "<a href=\"" + node.attrs.href + "\">" + next(node.children) + "</a>"; | ||
_a[NodeType$1.LINK] = function (node, next) { | ||
return "<a href=\"".concat(node.attrs.href || node.attrs.url, "\">").concat(next(node.children), "</a>"); | ||
}, | ||
_a$1[NodeType$1.IMAGE] = function (node, next) { | ||
return "<img src=\"" + node.attrs.src + "\" />" + next(node.children); | ||
_a[NodeType$1.IMAGE] = function (node, next) { | ||
return "<img src=\"".concat(node.attrs.src || node.attrs.url, "\" />").concat(next(node.children)); | ||
}, | ||
_a$1[NodeType$1.EMBED] = function (node, next) { | ||
return "<iframe src=\"" + node.attrs.src + "\">" + next(node.children) + "</iframe>"; | ||
_a[NodeType$1.EMBED] = function (node, next) { | ||
return "<iframe src=\"".concat(node.attrs.src || node.attrs.url, "\">").concat(next(node.children), "</iframe>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_1] = function (node, next) { | ||
return "<h1>" + next(node.children) + "</h1>"; | ||
_a[NodeType$1.HEADING_1] = function (node, next) { | ||
return "<h1>".concat(next(node.children), "</h1>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_2] = function (node, next) { | ||
return "<h2>" + next(node.children) + "</h2>"; | ||
_a[NodeType$1.HEADING_2] = function (node, next) { | ||
return "<h2>".concat(next(node.children), "</h2>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_3] = function (node, next) { | ||
return "<h3>" + next(node.children) + "</h3>"; | ||
_a[NodeType$1.HEADING_3] = function (node, next) { | ||
return "<h3>".concat(next(node.children), "</h3>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_4] = function (node, next) { | ||
return "<h4>" + next(node.children) + "</h4>"; | ||
_a[NodeType$1.HEADING_4] = function (node, next) { | ||
return "<h4>".concat(next(node.children), "</h4>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_5] = function (node, next) { | ||
return "<h5>" + next(node.children) + "</h5>"; | ||
_a[NodeType$1.HEADING_5] = function (node, next) { | ||
return "<h5>".concat(next(node.children), "</h5>"); | ||
}, | ||
_a$1[NodeType$1.HEADING_6] = function (node, next) { | ||
return "<h6>" + next(node.children) + "</h6>"; | ||
_a[NodeType$1.HEADING_6] = function (node, next) { | ||
return "<h6>".concat(next(node.children), "</h6>"); | ||
}, | ||
_a$1[NodeType$1.ORDER_LIST] = function (node, next) { | ||
return "<ol>" + next(node.children) + "</ol>"; | ||
_a[NodeType$1.ORDER_LIST] = function (node, next) { | ||
return "<ol>".concat(next(node.children), "</ol>"); | ||
}, | ||
_a$1[NodeType$1.UNORDER_LIST] = function (node, next) { | ||
return "<ul>" + next(node.children) + "</ul>"; | ||
_a[NodeType$1.UNORDER_LIST] = function (node, next) { | ||
return "<ul>".concat(next(node.children), "</ul>"); | ||
}, | ||
_a$1[NodeType$1.LIST_ITEM] = function (node, next) { | ||
return "<li>" + next(node.children) + "</li>"; | ||
_a[NodeType$1.LIST_ITEM] = function (node, next) { | ||
return "<li>".concat(next(node.children), "</li>"); | ||
}, | ||
_a$1[NodeType$1.HR] = function (node, next) { | ||
_a[NodeType$1.HR] = function (node, next) { | ||
return "<hr>"; | ||
}, | ||
_a$1[NodeType$1.TABLE] = function (node, next) { | ||
return "<table>" + next(node.children) + "</table>"; | ||
_a[NodeType$1.TABLE] = function (node, next) { | ||
return "<table>".concat(next(node.children), "</table>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_HEADER] = function (node, next) { | ||
return "<thead>" + next(node.children) + "</thead>"; | ||
_a[NodeType$1.TABLE_HEADER] = function (node, next) { | ||
return "<thead>".concat(next(node.children), "</thead>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_BODY] = function (node, next) { | ||
return "<tbody>" + next(node.children) + "</tbody>"; | ||
_a[NodeType$1.TABLE_BODY] = function (node, next) { | ||
return "<tbody>".concat(next(node.children), "</tbody>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_FOOTER] = function (node, next) { | ||
return "<tfoot>" + next(node.children) + "</tfoot>"; | ||
_a[NodeType$1.TABLE_FOOTER] = function (node, next) { | ||
return "<tfoot>".concat(next(node.children), "</tfoot>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_ROW] = function (node, next) { | ||
return "<tr>" + next(node.children) + "</tr>"; | ||
_a[NodeType$1.TABLE_ROW] = function (node, next) { | ||
return "<tr>".concat(next(node.children), "</tr>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_HEAD] = function (node, next) { | ||
return "<th>" + next(node.children) + "</th>"; | ||
_a[NodeType$1.TABLE_HEAD] = function (node, next) { | ||
return "<th>".concat(next(node.children), "</th>"); | ||
}, | ||
_a$1[NodeType$1.TABLE_DATA] = function (node, next) { | ||
return "<td>" + next(node.children) + "</td>"; | ||
_a[NodeType$1.TABLE_DATA] = function (node, next) { | ||
return "<td>".concat(next(node.children), "</td>"); | ||
}, | ||
_a$1[NodeType$1.BLOCK_QUOTE] = function (node, next) { | ||
return "<blockquote>" + next(node.children) + "</blockquote>"; | ||
_a[NodeType$1.BLOCK_QUOTE] = function (node, next) { | ||
return "<blockquote>".concat(next(node.children), "</blockquote>"); | ||
}, | ||
_a$1[NodeType$1.CODE] = function (node, next) { | ||
return "<code>" + next(node.children) + "</code>"; | ||
_a[NodeType$1.CODE] = function (node, next) { | ||
return "<code>".concat(next(node.children), "</code>"); | ||
}, | ||
_a$1['reference'] = function (node, next) { | ||
_a['reference'] = function (node, next) { | ||
return ""; | ||
}, | ||
_a$1['default'] = function (node, next) { | ||
_a['default'] = function (node, next) { | ||
return next(node.children); | ||
}, | ||
_a$1[MarkType$1.BOLD] = function (text) { | ||
return "<strong>" + text + "</strong>"; | ||
_a[MarkType$1.BOLD] = function (text) { | ||
return "<strong>".concat(text, "</strong>"); | ||
}, | ||
_a$1[MarkType$1.ITALIC] = function (text) { | ||
return "<em>" + text + "</em>"; | ||
_a[MarkType$1.ITALIC] = function (text) { | ||
return "<em>".concat(text, "</em>"); | ||
}, | ||
_a$1[MarkType$1.UNDERLINE] = function (text) { | ||
return "<u>" + text + "</u>"; | ||
_a[MarkType$1.UNDERLINE] = function (text) { | ||
return "<u>".concat(text, "</u>"); | ||
}, | ||
_a$1[MarkType$1.STRIKE_THROUGH] = function (text) { | ||
return "<strike>" + text + "</strike>"; | ||
_a[MarkType$1.STRIKE_THROUGH] = function (text) { | ||
return "<strike>".concat(text, "</strike>"); | ||
}, | ||
_a$1[MarkType$1.INLINE_CODE] = function (text) { | ||
return "<span>" + text + "</span>"; | ||
_a[MarkType$1.INLINE_CODE] = function (text) { | ||
return "<span>".concat(text, "</span>"); | ||
}, | ||
_a$1[MarkType$1.SUBSCRIPT] = function (text) { | ||
return "<sub>" + text + "</sub>"; | ||
_a[MarkType$1.SUBSCRIPT] = function (text) { | ||
return "<sub>".concat(text, "</sub>"); | ||
}, | ||
_a$1[MarkType$1.SUPERSCRIPT] = function (text) { | ||
return "<sup>" + text + "</sup>"; | ||
_a[MarkType$1.SUPERSCRIPT] = function (text) { | ||
return "<sup>".concat(text, "</sup>"); | ||
}, | ||
_a$1); | ||
_a); | ||
@@ -573,10 +573,10 @@ function enumerate(entries, process) { | ||
function jsonToHTML(option) { | ||
function jsonToHTML$1(option) { | ||
if (option.entry instanceof Array) { | ||
enumerate(option.entry, function (entry) { | ||
jsonToHTML({ entry: entry, paths: option.paths, renderOption: option.renderOption }); | ||
jsonToHTML$1({ entry: entry, paths: option.paths, renderOption: option.renderOption }); | ||
}); | ||
} | ||
else { | ||
enumerateKeys({ | ||
enumerateKeys$1({ | ||
entry: option.entry, | ||
@@ -588,3 +588,3 @@ paths: option.paths, | ||
} | ||
function enumerateKeys(option) { | ||
function enumerateKeys$1(option) { | ||
for (var _i = 0, _a = option.paths; _i < _a.length; _i++) { | ||
@@ -600,10 +600,10 @@ var key = _a[_i]; | ||
function jsonToHTML$1(option) { | ||
function jsonToHTML(option) { | ||
if (option.entry instanceof Array) { | ||
enumerate(option.entry, function (entry) { | ||
jsonToHTML$1({ entry: entry, paths: option.paths, renderOption: option.renderOption }); | ||
jsonToHTML({ entry: entry, paths: option.paths, renderOption: option.renderOption }); | ||
}); | ||
} | ||
else { | ||
enumerateKeys$1({ | ||
enumerateKeys({ | ||
entry: option.entry, | ||
@@ -615,3 +615,3 @@ paths: option.paths, | ||
} | ||
function enumerateKeys$1(option) { | ||
function enumerateKeys(option) { | ||
for (var _i = 0, _a = option.paths; _i < _a.length; _i++) { | ||
@@ -632,3 +632,3 @@ var key = _a[_i]; | ||
var GQL = { | ||
jsonToHTML: jsonToHTML$1 | ||
jsonToHTML: jsonToHTML | ||
}; | ||
@@ -639,3 +639,3 @@ | ||
if (entry) | ||
entry.$ = getTag(entry, contentTypeUid + "." + entry.uid + "." + locale, tagsAsObject, locale); | ||
entry.$ = getTag(entry, "".concat(contentTypeUid, ".").concat(entry.uid, ".").concat(locale), tagsAsObject, locale); | ||
} | ||
@@ -650,11 +650,11 @@ function getTag(content, prefix, tagsAsObject, locale) { | ||
value.forEach(function (obj, index) { | ||
if ((typeof obj !== 'undefined' || obj !== null) && obj._content_type_uid !== undefined && obj.uid !== undefined) { | ||
value[index].$ = getTag(obj, obj._content_type_uid + "." + obj.uid + "." + (obj.locale || locale), tagsAsObject, locale); | ||
if (typeof obj !== 'undefined' && obj !== null && obj._content_type_uid !== undefined && obj.uid !== undefined) { | ||
value[index].$ = getTag(obj, "".concat(obj._content_type_uid, ".").concat(obj.uid, ".").concat(obj.locale || locale), tagsAsObject, locale); | ||
} | ||
else { | ||
if (typeof obj === "object") { | ||
obj.$ = getTag(obj, prefix + "." + key + "." + index, tagsAsObject, locale); | ||
obj.$ = getTag(obj, "".concat(prefix, ".").concat(key, ".").concat(index), tagsAsObject, locale); | ||
} | ||
else { | ||
tags[key] = getTagsValue(prefix + "." + key, tagsAsObject); | ||
tags[key] = getTagsValue("".concat(prefix, ".").concat(key), tagsAsObject); | ||
} | ||
@@ -666,3 +666,3 @@ } | ||
if (value) { | ||
value.$ = getTag(value, prefix + "." + key, tagsAsObject, locale); | ||
value.$ = getTag(value, "".concat(prefix, ".").concat(key), tagsAsObject, locale); | ||
} | ||
@@ -672,3 +672,3 @@ } | ||
default: | ||
tags[key] = getTagsValue(prefix + "." + key, tagsAsObject); | ||
tags[key] = getTagsValue("".concat(prefix, ".").concat(key), tagsAsObject); | ||
} | ||
@@ -683,3 +683,3 @@ }); | ||
else { | ||
return "data-cslp=" + dataValue; | ||
return "data-cslp=".concat(dataValue); | ||
} | ||
@@ -697,5 +697,5 @@ } | ||
exports.attributeToString = attributeToString; | ||
exports.jsonToHTML = jsonToHTML; | ||
exports.jsonToHTML = jsonToHTML$1; | ||
exports.render = render; | ||
exports.renderContent = renderContent; | ||
//# sourceMappingURL=index.es.js.map |
export function addTags(entry, contentTypeUid, tagsAsObject, locale) { | ||
if (locale === void 0) { locale = 'en-us'; } | ||
if (entry) | ||
entry.$ = getTag(entry, contentTypeUid + "." + entry.uid + "." + locale, tagsAsObject, locale); | ||
entry.$ = getTag(entry, "".concat(contentTypeUid, ".").concat(entry.uid, ".").concat(locale), tagsAsObject, locale); | ||
} | ||
@@ -14,11 +14,11 @@ function getTag(content, prefix, tagsAsObject, locale) { | ||
value.forEach(function (obj, index) { | ||
if ((typeof obj !== 'undefined' || obj !== null) && obj._content_type_uid !== undefined && obj.uid !== undefined) { | ||
value[index].$ = getTag(obj, obj._content_type_uid + "." + obj.uid + "." + (obj.locale || locale), tagsAsObject, locale); | ||
if (typeof obj !== 'undefined' && obj !== null && obj._content_type_uid !== undefined && obj.uid !== undefined) { | ||
value[index].$ = getTag(obj, "".concat(obj._content_type_uid, ".").concat(obj.uid, ".").concat(obj.locale || locale), tagsAsObject, locale); | ||
} | ||
else { | ||
if (typeof obj === "object") { | ||
obj.$ = getTag(obj, prefix + "." + key + "." + index, tagsAsObject, locale); | ||
obj.$ = getTag(obj, "".concat(prefix, ".").concat(key, ".").concat(index), tagsAsObject, locale); | ||
} | ||
else { | ||
tags[key] = getTagsValue(prefix + "." + key, tagsAsObject); | ||
tags[key] = getTagsValue("".concat(prefix, ".").concat(key), tagsAsObject); | ||
} | ||
@@ -30,3 +30,3 @@ } | ||
if (value) { | ||
value.$ = getTag(value, prefix + "." + key, tagsAsObject, locale); | ||
value.$ = getTag(value, "".concat(prefix, ".").concat(key), tagsAsObject, locale); | ||
} | ||
@@ -36,3 +36,3 @@ } | ||
default: | ||
tags[key] = getTagsValue(prefix + "." + key, tagsAsObject); | ||
tags[key] = getTagsValue("".concat(prefix, ".").concat(key), tagsAsObject); | ||
} | ||
@@ -47,5 +47,5 @@ }); | ||
else { | ||
return "data-cslp=" + dataValue; | ||
return "data-cslp=".concat(dataValue); | ||
} | ||
} | ||
//# sourceMappingURL=entry-editable.js.map |
@@ -6,3 +6,3 @@ import { elementToJson } from '../helper/html-to-json'; | ||
String.prototype.forEachEmbeddedItem = function (callbackfn) { | ||
var str = "<" + frameflag + ">" + this.toString() + "</" + frameflag + ">"; | ||
var str = "<".concat(frameflag, ">").concat(this.toString(), "</").concat(frameflag, ">"); | ||
var root = parse(str); | ||
@@ -9,0 +9,0 @@ var embeddedEntries = root.querySelectorAll(".embedded-entry"); |
@@ -31,7 +31,7 @@ export function createMetadata(attribute) { | ||
if (isFirst_1) { | ||
elementString_1 += "" + value; | ||
elementString_1 += "".concat(value); | ||
isFirst_1 = false; | ||
} | ||
else { | ||
elementString_1 += ", " + value; | ||
elementString_1 += ", ".concat(value); | ||
} | ||
@@ -46,3 +46,3 @@ }); | ||
var value = element[elementKey]; | ||
elementString += elementKey + ":" + value + "; "; | ||
elementString += "".concat(elementKey, ":").concat(value, "; "); | ||
} | ||
@@ -52,3 +52,3 @@ } | ||
} | ||
result += " " + key + "=\"" + element + "\""; | ||
result += " ".concat(key, "=\"").concat(element, "\""); | ||
} | ||
@@ -55,0 +55,0 @@ }; |
@@ -9,2 +9,4 @@ var __extends = (this && this.__extends) || (function () { | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -11,0 +13,0 @@ function __() { this.constructor = d; } |
@@ -9,2 +9,4 @@ var __extends = (this && this.__extends) || (function () { | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -11,0 +13,0 @@ function __() { this.constructor = d; } |
@@ -9,39 +9,39 @@ var _a; | ||
_a[NodeType.PARAGRAPH] = function (node, next) { | ||
return "<p>" + next(node.children) + "</p>"; | ||
return "<p>".concat(next(node.children), "</p>"); | ||
}, | ||
_a[NodeType.LINK] = function (node, next) { | ||
return "<a href=\"" + node.attrs.href + "\">" + next(node.children) + "</a>"; | ||
return "<a href=\"".concat(node.attrs.href || node.attrs.url, "\">").concat(next(node.children), "</a>"); | ||
}, | ||
_a[NodeType.IMAGE] = function (node, next) { | ||
return "<img src=\"" + node.attrs.src + "\" />" + next(node.children); | ||
return "<img src=\"".concat(node.attrs.src || node.attrs.url, "\" />").concat(next(node.children)); | ||
}, | ||
_a[NodeType.EMBED] = function (node, next) { | ||
return "<iframe src=\"" + node.attrs.src + "\">" + next(node.children) + "</iframe>"; | ||
return "<iframe src=\"".concat(node.attrs.src || node.attrs.url, "\">").concat(next(node.children), "</iframe>"); | ||
}, | ||
_a[NodeType.HEADING_1] = function (node, next) { | ||
return "<h1>" + next(node.children) + "</h1>"; | ||
return "<h1>".concat(next(node.children), "</h1>"); | ||
}, | ||
_a[NodeType.HEADING_2] = function (node, next) { | ||
return "<h2>" + next(node.children) + "</h2>"; | ||
return "<h2>".concat(next(node.children), "</h2>"); | ||
}, | ||
_a[NodeType.HEADING_3] = function (node, next) { | ||
return "<h3>" + next(node.children) + "</h3>"; | ||
return "<h3>".concat(next(node.children), "</h3>"); | ||
}, | ||
_a[NodeType.HEADING_4] = function (node, next) { | ||
return "<h4>" + next(node.children) + "</h4>"; | ||
return "<h4>".concat(next(node.children), "</h4>"); | ||
}, | ||
_a[NodeType.HEADING_5] = function (node, next) { | ||
return "<h5>" + next(node.children) + "</h5>"; | ||
return "<h5>".concat(next(node.children), "</h5>"); | ||
}, | ||
_a[NodeType.HEADING_6] = function (node, next) { | ||
return "<h6>" + next(node.children) + "</h6>"; | ||
return "<h6>".concat(next(node.children), "</h6>"); | ||
}, | ||
_a[NodeType.ORDER_LIST] = function (node, next) { | ||
return "<ol>" + next(node.children) + "</ol>"; | ||
return "<ol>".concat(next(node.children), "</ol>"); | ||
}, | ||
_a[NodeType.UNORDER_LIST] = function (node, next) { | ||
return "<ul>" + next(node.children) + "</ul>"; | ||
return "<ul>".concat(next(node.children), "</ul>"); | ||
}, | ||
_a[NodeType.LIST_ITEM] = function (node, next) { | ||
return "<li>" + next(node.children) + "</li>"; | ||
return "<li>".concat(next(node.children), "</li>"); | ||
}, | ||
@@ -52,27 +52,27 @@ _a[NodeType.HR] = function (node, next) { | ||
_a[NodeType.TABLE] = function (node, next) { | ||
return "<table>" + next(node.children) + "</table>"; | ||
return "<table>".concat(next(node.children), "</table>"); | ||
}, | ||
_a[NodeType.TABLE_HEADER] = function (node, next) { | ||
return "<thead>" + next(node.children) + "</thead>"; | ||
return "<thead>".concat(next(node.children), "</thead>"); | ||
}, | ||
_a[NodeType.TABLE_BODY] = function (node, next) { | ||
return "<tbody>" + next(node.children) + "</tbody>"; | ||
return "<tbody>".concat(next(node.children), "</tbody>"); | ||
}, | ||
_a[NodeType.TABLE_FOOTER] = function (node, next) { | ||
return "<tfoot>" + next(node.children) + "</tfoot>"; | ||
return "<tfoot>".concat(next(node.children), "</tfoot>"); | ||
}, | ||
_a[NodeType.TABLE_ROW] = function (node, next) { | ||
return "<tr>" + next(node.children) + "</tr>"; | ||
return "<tr>".concat(next(node.children), "</tr>"); | ||
}, | ||
_a[NodeType.TABLE_HEAD] = function (node, next) { | ||
return "<th>" + next(node.children) + "</th>"; | ||
return "<th>".concat(next(node.children), "</th>"); | ||
}, | ||
_a[NodeType.TABLE_DATA] = function (node, next) { | ||
return "<td>" + next(node.children) + "</td>"; | ||
return "<td>".concat(next(node.children), "</td>"); | ||
}, | ||
_a[NodeType.BLOCK_QUOTE] = function (node, next) { | ||
return "<blockquote>" + next(node.children) + "</blockquote>"; | ||
return "<blockquote>".concat(next(node.children), "</blockquote>"); | ||
}, | ||
_a[NodeType.CODE] = function (node, next) { | ||
return "<code>" + next(node.children) + "</code>"; | ||
return "<code>".concat(next(node.children), "</code>"); | ||
}, | ||
@@ -86,23 +86,23 @@ _a['reference'] = function (node, next) { | ||
_a[MarkType.BOLD] = function (text) { | ||
return "<strong>" + text + "</strong>"; | ||
return "<strong>".concat(text, "</strong>"); | ||
}, | ||
_a[MarkType.ITALIC] = function (text) { | ||
return "<em>" + text + "</em>"; | ||
return "<em>".concat(text, "</em>"); | ||
}, | ||
_a[MarkType.UNDERLINE] = function (text) { | ||
return "<u>" + text + "</u>"; | ||
return "<u>".concat(text, "</u>"); | ||
}, | ||
_a[MarkType.STRIKE_THROUGH] = function (text) { | ||
return "<strike>" + text + "</strike>"; | ||
return "<strike>".concat(text, "</strike>"); | ||
}, | ||
_a[MarkType.INLINE_CODE] = function (text) { | ||
return "<span>" + text + "</span>"; | ||
return "<span>".concat(text, "</span>"); | ||
}, | ||
_a[MarkType.SUBSCRIPT] = function (text) { | ||
return "<sub>" + text + "</sub>"; | ||
return "<sub>".concat(text, "</sub>"); | ||
}, | ||
_a[MarkType.SUPERSCRIPT] = function (text) { | ||
return "<sup>" + text + "</sup>"; | ||
return "<sup>".concat(text, "</sup>"); | ||
}, | ||
_a); | ||
//# sourceMappingURL=default-node-options.js.map |
@@ -5,10 +5,10 @@ var _a; | ||
_a[StyleType.BLOCK] = function (item) { | ||
return "<div><p>" + (item.title || item.uid) + "</p><p>Content type: <span>" + (item._content_type_uid || (item.system ? item.system.content_type_uid : '')) + "</span></p></div>"; | ||
return "<div><p>".concat(item.title || item.uid, "</p><p>Content type: <span>").concat(item._content_type_uid || (item.system ? item.system.content_type_uid : ''), "</span></p></div>"); | ||
}, | ||
_a[StyleType.INLINE] = function (item) { return "<span>" + (item.title || item.uid) + "</span>"; }, | ||
_a[StyleType.LINK] = function (item, metadata) { return "<a href=\"" + item.url + "\">" + (metadata.text || item.title || item.uid || (item.system ? item.system.uid : '')) + "</a>"; }, | ||
_a[StyleType.DISPLAY] = function (item, metadata) { return "<img src=\"" + item.url + "\" alt=\"" + (metadata.attributes.alt || item.title || item.filename || item.uid | ||
|| (item.system ? item.system.uid : '')) + "\" />"; }, | ||
_a[StyleType.DOWNLOAD] = function (item, metadata) { return "<a href=\"" + item.url + "\">" + (metadata.text || item.title || item.uid || (item.system ? item.system.content_type_uid : '')) + "</a>"; }, | ||
_a[StyleType.INLINE] = function (item) { return "<span>".concat(item.title || item.uid, "</span>"); }, | ||
_a[StyleType.LINK] = function (item, metadata) { return "<a href=\"".concat(item.url, "\">").concat(metadata.text || item.title || item.uid || (item.system ? item.system.uid : ''), "</a>"); }, | ||
_a[StyleType.DISPLAY] = function (item, metadata) { return "<img src=\"".concat(item.url, "\" alt=\"").concat(metadata.attributes.alt || item.title || item.filename || item.uid | ||
|| (item.system ? item.system.uid : ''), "\" />"); }, | ||
_a[StyleType.DOWNLOAD] = function (item, metadata) { return "<a href=\"".concat(item.url, "\">").concat(metadata.text || item.title || item.uid || (item.system ? item.system.content_type_uid : ''), "</a>"); }, | ||
_a); | ||
//# sourceMappingURL=default-options.js.map |
{ | ||
"name": "@contentstack/utils", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Contentstack utilities for Javascript", | ||
@@ -38,15 +38,15 @@ "main": "dist/index.es.js", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.15.8", | ||
"@types/jest": "^26.0.13", | ||
"@babel/preset-env": "^7.16.11", | ||
"@types/jest": "^26.0.24", | ||
"babel-core": "^6.26.3", | ||
"babel-jest": "^27.3.1", | ||
"babel-jest": "^27.5.1", | ||
"babel-loader": "8.1.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"eslint": "^8.0.1", | ||
"jest": "^27.2.5", | ||
"eslint": "^8.12.0", | ||
"jest": "^27.5.1", | ||
"jest-coverage-badges": "^1.1.2", | ||
"jest-html-reporters": "^2.0.4", | ||
"jsdoc": "^3.6.7", | ||
"prettier": "^2.1.2", | ||
"rollup": "^2.32.1", | ||
"jest-html-reporters": "^2.1.7", | ||
"jsdoc": "^3.6.10", | ||
"prettier": "^2.6.1", | ||
"rollup": "^2.70.1", | ||
"rollup-plugin-json": "^4.0.0", | ||
@@ -56,9 +56,9 @@ "rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-typescript2": "^0.28.0", | ||
"ts-jest": "^27.0.0-next.12", | ||
"ts-jest": "^27.1.4", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.6.3" | ||
}, | ||
"dependencies": { | ||
"node-html-parser": "^1.4.2" | ||
"node-html-parser": "^1.4.9" | ||
}, | ||
@@ -65,0 +65,0 @@ "babel": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156160
1630
Updatednode-html-parser@^1.4.9