@contentful/rich-text-plain-text-renderer
Advanced tools
Comparing version 16.0.13 to 16.1.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
var dist = {}; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var blocks = {}; | ||
var blocks = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BLOCKS = void 0; | ||
Object.defineProperty(blocks, "__esModule", { value: true }); | ||
blocks.BLOCKS = void 0; | ||
/** | ||
@@ -43,12 +36,8 @@ * Map of all Contentful block types. Blocks contain inline or block nodes. | ||
BLOCKS["TABLE_HEADER_CELL"] = "table-header-cell"; | ||
})(BLOCKS || (exports.BLOCKS = BLOCKS = {})); | ||
})(BLOCKS || (blocks.BLOCKS = BLOCKS = {})); | ||
}); | ||
var inlines = {}; | ||
unwrapExports(blocks); | ||
var blocks_1 = blocks.BLOCKS; | ||
var inlines = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.INLINES = void 0; | ||
Object.defineProperty(inlines, "__esModule", { value: true }); | ||
inlines.INLINES = void 0; | ||
/** | ||
@@ -65,12 +54,8 @@ * Map of all Contentful inline types. Inline contain inline or text nodes. | ||
INLINES["EMBEDDED_RESOURCE"] = "embedded-resource-inline"; | ||
})(INLINES || (exports.INLINES = INLINES = {})); | ||
})(INLINES || (inlines.INLINES = INLINES = {})); | ||
}); | ||
var marks = {}; | ||
unwrapExports(inlines); | ||
var inlines_1 = inlines.INLINES; | ||
var marks = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MARKS = void 0; | ||
Object.defineProperty(marks, "__esModule", { value: true }); | ||
marks.MARKS = void 0; | ||
/** | ||
@@ -87,171 +72,152 @@ * Map of all Contentful marks. | ||
MARKS["SUBSCRIPT"] = "subscript"; | ||
})(MARKS || (exports.MARKS = MARKS = {})); | ||
})(MARKS || (marks.MARKS = MARKS = {})); | ||
}); | ||
var schemaConstraints = {}; | ||
unwrapExports(marks); | ||
var marks_1 = marks.MARKS; | ||
(function (exports) { | ||
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0; | ||
var blocks_1 = blocks; | ||
var inlines_1 = inlines; | ||
var marks_1 = marks; | ||
/** | ||
* Array of all top level block types. | ||
* Only these block types can be the direct children of the document. | ||
*/ | ||
exports.TOP_LEVEL_BLOCKS = [ | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
blocks_1.BLOCKS.TABLE, | ||
]; | ||
/** | ||
* Array of all allowed block types inside list items | ||
*/ | ||
exports.LIST_ITEM_BLOCKS = [ | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
exports.TABLE_BLOCKS = [ | ||
blocks_1.BLOCKS.TABLE, | ||
blocks_1.BLOCKS.TABLE_ROW, | ||
blocks_1.BLOCKS.TABLE_CELL, | ||
blocks_1.BLOCKS.TABLE_HEADER_CELL, | ||
]; | ||
/** | ||
* Array of all void block types | ||
*/ | ||
exports.VOID_BLOCKS = [ | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
blocks_1.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
/** | ||
* Dictionary of all container block types, and the set block types they accept as children. | ||
* | ||
* Note: This does not include `[BLOCKS.DOCUMENT]: TOP_LEVEL_BLOCKS` | ||
*/ | ||
exports.CONTAINERS = (_a = {}, | ||
_a[blocks_1.BLOCKS.OL_LIST] = [blocks_1.BLOCKS.LIST_ITEM], | ||
_a[blocks_1.BLOCKS.UL_LIST] = [blocks_1.BLOCKS.LIST_ITEM], | ||
_a[blocks_1.BLOCKS.LIST_ITEM] = exports.LIST_ITEM_BLOCKS, | ||
_a[blocks_1.BLOCKS.QUOTE] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a[blocks_1.BLOCKS.TABLE] = [blocks_1.BLOCKS.TABLE_ROW], | ||
_a[blocks_1.BLOCKS.TABLE_ROW] = [blocks_1.BLOCKS.TABLE_CELL, blocks_1.BLOCKS.TABLE_HEADER_CELL], | ||
_a[blocks_1.BLOCKS.TABLE_CELL] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a[blocks_1.BLOCKS.TABLE_HEADER_CELL] = [blocks_1.BLOCKS.PARAGRAPH], | ||
_a); | ||
/** | ||
* Array of all heading levels | ||
*/ | ||
exports.HEADINGS = [ | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
]; | ||
/** | ||
* Array of all block types that may contain text and inline nodes. | ||
*/ | ||
exports.TEXT_CONTAINERS = __spreadArray([blocks_1.BLOCKS.PARAGRAPH], exports.HEADINGS, true); | ||
/** | ||
* Node types before `tables` release. | ||
*/ | ||
exports.V1_NODE_TYPES = [ | ||
blocks_1.BLOCKS.DOCUMENT, | ||
blocks_1.BLOCKS.PARAGRAPH, | ||
blocks_1.BLOCKS.HEADING_1, | ||
blocks_1.BLOCKS.HEADING_2, | ||
blocks_1.BLOCKS.HEADING_3, | ||
blocks_1.BLOCKS.HEADING_4, | ||
blocks_1.BLOCKS.HEADING_5, | ||
blocks_1.BLOCKS.HEADING_6, | ||
blocks_1.BLOCKS.OL_LIST, | ||
blocks_1.BLOCKS.UL_LIST, | ||
blocks_1.BLOCKS.LIST_ITEM, | ||
blocks_1.BLOCKS.HR, | ||
blocks_1.BLOCKS.QUOTE, | ||
blocks_1.BLOCKS.EMBEDDED_ENTRY, | ||
blocks_1.BLOCKS.EMBEDDED_ASSET, | ||
inlines_1.INLINES.HYPERLINK, | ||
inlines_1.INLINES.ENTRY_HYPERLINK, | ||
inlines_1.INLINES.ASSET_HYPERLINK, | ||
inlines_1.INLINES.EMBEDDED_ENTRY, | ||
'text', | ||
]; | ||
/** | ||
* Marks before `superscript` & `subscript` release. | ||
*/ | ||
exports.V1_MARKS = [marks_1.MARKS.BOLD, marks_1.MARKS.CODE, marks_1.MARKS.ITALIC, marks_1.MARKS.UNDERLINE]; | ||
} (schemaConstraints)); | ||
var schemaConstraints = createCommonjsModule(function (module, exports) { | ||
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0; | ||
var types = {}; | ||
Object.defineProperty(types, "__esModule", { value: true }); | ||
var nodeTypes = {}; | ||
/** | ||
* Array of all top level block types. | ||
* Only these block types can be the direct children of the document. | ||
*/ | ||
exports.TOP_LEVEL_BLOCKS = [ | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
blocks.BLOCKS.TABLE, | ||
]; | ||
/** | ||
* Array of all allowed block types inside list items | ||
*/ | ||
exports.LIST_ITEM_BLOCKS = [ | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
exports.TABLE_BLOCKS = [ | ||
blocks.BLOCKS.TABLE, | ||
blocks.BLOCKS.TABLE_ROW, | ||
blocks.BLOCKS.TABLE_CELL, | ||
blocks.BLOCKS.TABLE_HEADER_CELL, | ||
]; | ||
/** | ||
* Array of all void block types | ||
*/ | ||
exports.VOID_BLOCKS = [ | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
blocks.BLOCKS.EMBEDDED_RESOURCE, | ||
]; | ||
/** | ||
* Dictionary of all container block types, and the set block types they accept as children. | ||
* | ||
* Note: This does not include `[BLOCKS.DOCUMENT]: TOP_LEVEL_BLOCKS` | ||
*/ | ||
exports.CONTAINERS = (_a = {}, | ||
_a[blocks.BLOCKS.OL_LIST] = [blocks.BLOCKS.LIST_ITEM], | ||
_a[blocks.BLOCKS.UL_LIST] = [blocks.BLOCKS.LIST_ITEM], | ||
_a[blocks.BLOCKS.LIST_ITEM] = exports.LIST_ITEM_BLOCKS, | ||
_a[blocks.BLOCKS.QUOTE] = [blocks.BLOCKS.PARAGRAPH], | ||
_a[blocks.BLOCKS.TABLE] = [blocks.BLOCKS.TABLE_ROW], | ||
_a[blocks.BLOCKS.TABLE_ROW] = [blocks.BLOCKS.TABLE_CELL, blocks.BLOCKS.TABLE_HEADER_CELL], | ||
_a[blocks.BLOCKS.TABLE_CELL] = [blocks.BLOCKS.PARAGRAPH], | ||
_a[blocks.BLOCKS.TABLE_HEADER_CELL] = [blocks.BLOCKS.PARAGRAPH], | ||
_a); | ||
/** | ||
* Array of all heading levels | ||
*/ | ||
exports.HEADINGS = [ | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
]; | ||
/** | ||
* Array of all block types that may contain text and inline nodes. | ||
*/ | ||
exports.TEXT_CONTAINERS = __spreadArray([blocks.BLOCKS.PARAGRAPH], exports.HEADINGS, true); | ||
/** | ||
* Node types before `tables` release. | ||
*/ | ||
exports.V1_NODE_TYPES = [ | ||
blocks.BLOCKS.DOCUMENT, | ||
blocks.BLOCKS.PARAGRAPH, | ||
blocks.BLOCKS.HEADING_1, | ||
blocks.BLOCKS.HEADING_2, | ||
blocks.BLOCKS.HEADING_3, | ||
blocks.BLOCKS.HEADING_4, | ||
blocks.BLOCKS.HEADING_5, | ||
blocks.BLOCKS.HEADING_6, | ||
blocks.BLOCKS.OL_LIST, | ||
blocks.BLOCKS.UL_LIST, | ||
blocks.BLOCKS.LIST_ITEM, | ||
blocks.BLOCKS.HR, | ||
blocks.BLOCKS.QUOTE, | ||
blocks.BLOCKS.EMBEDDED_ENTRY, | ||
blocks.BLOCKS.EMBEDDED_ASSET, | ||
inlines.INLINES.HYPERLINK, | ||
inlines.INLINES.ENTRY_HYPERLINK, | ||
inlines.INLINES.ASSET_HYPERLINK, | ||
inlines.INLINES.EMBEDDED_ENTRY, | ||
'text', | ||
]; | ||
/** | ||
* Marks before `superscript` & `subscript` release. | ||
*/ | ||
exports.V1_MARKS = [marks.MARKS.BOLD, marks.MARKS.CODE, marks.MARKS.ITALIC, marks.MARKS.UNDERLINE]; | ||
Object.defineProperty(nodeTypes, "__esModule", { value: true }); | ||
}); | ||
var emptyDocument = {}; | ||
unwrapExports(schemaConstraints); | ||
var schemaConstraints_1 = schemaConstraints.V1_MARKS; | ||
var schemaConstraints_2 = schemaConstraints.V1_NODE_TYPES; | ||
var schemaConstraints_3 = schemaConstraints.TEXT_CONTAINERS; | ||
var schemaConstraints_4 = schemaConstraints.HEADINGS; | ||
var schemaConstraints_5 = schemaConstraints.CONTAINERS; | ||
var schemaConstraints_6 = schemaConstraints.VOID_BLOCKS; | ||
var schemaConstraints_7 = schemaConstraints.TABLE_BLOCKS; | ||
var schemaConstraints_8 = schemaConstraints.LIST_ITEM_BLOCKS; | ||
var schemaConstraints_9 = schemaConstraints.TOP_LEVEL_BLOCKS; | ||
var types = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
}); | ||
unwrapExports(types); | ||
var nodeTypes = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
}); | ||
unwrapExports(nodeTypes); | ||
var emptyDocument = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EMPTY_DOCUMENT = void 0; | ||
Object.defineProperty(emptyDocument, "__esModule", { value: true }); | ||
emptyDocument.EMPTY_DOCUMENT = void 0; | ||
var blocks_1$1 = blocks; | ||
/** | ||
@@ -261,8 +227,8 @@ * A rich text document considered to be empty. | ||
*/ | ||
exports.EMPTY_DOCUMENT = { | ||
nodeType: blocks.BLOCKS.DOCUMENT, | ||
emptyDocument.EMPTY_DOCUMENT = { | ||
nodeType: blocks_1$1.BLOCKS.DOCUMENT, | ||
data: {}, | ||
content: [ | ||
{ | ||
nodeType: blocks.BLOCKS.PARAGRAPH, | ||
nodeType: blocks_1$1.BLOCKS.PARAGRAPH, | ||
data: {}, | ||
@@ -281,12 +247,8 @@ content: [ | ||
}); | ||
var helpers = {}; | ||
unwrapExports(emptyDocument); | ||
var emptyDocument_1 = emptyDocument.EMPTY_DOCUMENT; | ||
var helpers = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isText = exports.isBlock = exports.isInline = void 0; | ||
Object.defineProperty(helpers, "__esModule", { value: true }); | ||
helpers.isText = helpers.isBlock = helpers.isInline = void 0; | ||
var blocks_1 = blocks; | ||
var inlines_1 = inlines; | ||
/** | ||
@@ -309,5 +271,5 @@ * Tiny replacement for Object.values(object).includes(key) to | ||
function isInline(node) { | ||
return hasValue(inlines.INLINES, node.nodeType); | ||
return hasValue(inlines_1.INLINES, node.nodeType); | ||
} | ||
exports.isInline = isInline; | ||
helpers.isInline = isInline; | ||
/** | ||
@@ -317,5 +279,5 @@ * Checks if the node is an instance of Block. | ||
function isBlock(node) { | ||
return hasValue(blocks.BLOCKS, node.nodeType); | ||
return hasValue(blocks_1.BLOCKS, node.nodeType); | ||
} | ||
exports.isBlock = isBlock; | ||
helpers.isBlock = isBlock; | ||
/** | ||
@@ -327,63 +289,49 @@ * Checks if the node is an instance of Text. | ||
} | ||
exports.isText = isText; | ||
helpers.isText = isText; | ||
}); | ||
(function (exports) { | ||
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0; | ||
var blocks_1 = blocks; | ||
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks_1.BLOCKS; } }); | ||
var inlines_1 = inlines; | ||
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines_1.INLINES; } }); | ||
var marks_1 = marks; | ||
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks_1.MARKS; } }); | ||
__exportStar(schemaConstraints, exports); | ||
__exportStar(types, exports); | ||
__exportStar(nodeTypes, exports); | ||
var emptyDocument_1 = emptyDocument; | ||
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument_1.EMPTY_DOCUMENT; } }); | ||
var helpers$1 = __importStar(helpers); | ||
exports.helpers = helpers$1; | ||
} (dist)); | ||
unwrapExports(helpers); | ||
var helpers_1 = helpers.isText; | ||
var helpers_2 = helpers.isBlock; | ||
var helpers_3 = helpers.isInline; | ||
var dist = createCommonjsModule(function (module, exports) { | ||
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0; | ||
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks.BLOCKS; } }); | ||
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines.INLINES; } }); | ||
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks.MARKS; } }); | ||
__exportStar(schemaConstraints, exports); | ||
__exportStar(types, exports); | ||
__exportStar(nodeTypes, exports); | ||
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument.EMPTY_DOCUMENT; } }); | ||
var helpers$1 = __importStar(helpers); | ||
exports.helpers = helpers$1; | ||
}); | ||
unwrapExports(dist); | ||
var dist_1 = dist.helpers; | ||
var dist_2 = dist.EMPTY_DOCUMENT; | ||
var dist_3 = dist.MARKS; | ||
var dist_4 = dist.INLINES; | ||
var dist_5 = dist.BLOCKS; | ||
/** | ||
@@ -472,6 +420,6 @@ * Returns the text value of a rich text document. | ||
var nodeTextValue; | ||
if (dist_1.isText(node)) { | ||
if (dist.helpers.isText(node)) { | ||
nodeTextValue = node.value; | ||
} | ||
else if (dist_1.isBlock(node) || dist_1.isInline(node)) { | ||
else if (dist.helpers.isBlock(node) || dist.helpers.isInline(node)) { | ||
nodeTextValue = documentToPlainTextString(node, blockDivisor); | ||
@@ -483,3 +431,3 @@ if (!nodeTextValue.length) { | ||
var nextNode = rootNode.content[i + 1]; | ||
var isNextNodeBlock = nextNode && dist_1.isBlock(nextNode); | ||
var isNextNodeBlock = nextNode && dist.helpers.isBlock(nextNode); | ||
var divisor = isNextNodeBlock ? blockDivisor : ''; | ||
@@ -486,0 +434,0 @@ return acc + nodeTextValue + divisor; |
{ | ||
"name": "@contentful/rich-text-plain-text-renderer", | ||
"version": "16.0.13", | ||
"version": "16.1.0", | ||
"main": "dist/rich-text-plain-text-renderer.es5.js", | ||
@@ -22,5 +22,5 @@ "typings": "dist/types/index.d.ts", | ||
"scripts": { | ||
"build": "tsc --module commonjs && rollup -c rollup.config.js", | ||
"build": "tsc --module commonjs && rollup -c --bundleConfigAsCjs rollup.config.js", | ||
"prebuild": "rimraf dist", | ||
"start": "tsc && rollup -c rollup.config.js -w", | ||
"start": "tsc && rollup -c --bundleConfigAsCjs rollup.config.js -w", | ||
"lint": "tslint -t codeFrame '@(src|bin)/*.ts'", | ||
@@ -30,13 +30,6 @@ "test": "jest" | ||
"dependencies": { | ||
"@contentful/rich-text-types": "^16.3.5" | ||
"@contentful/rich-text-types": "^16.4.0" | ||
}, | ||
"devDependencies": { | ||
"jest": "^27.1.0", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"ts-jest": "^29.1.2", | ||
@@ -46,3 +39,3 @@ "tslint": "^6.1.3", | ||
}, | ||
"gitHead": "cd42e95489da4fcb9221008c7d0cee815ecf9cc3" | ||
"gitHead": "f39fbb99956d719a695eb917dbddb5af969d52b6" | ||
} |
Sorry, the diff of this file is not supported yet
62409
4
691