@contentful/rich-text-react-renderer
Advanced tools
Comparing version 15.0.0 to 15.1.0
@@ -29,2 +29,4 @@ "use strict"; | ||
exports.quoteDoc = quote_1.default; | ||
var table_1 = require("./table"); | ||
exports.tableDoc = table_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -132,2 +132,6 @@ "use strict"; | ||
}); | ||
it('renders tables', function () { | ||
var document = documents_1.tableDoc; | ||
expect(__1.documentToReactComponents(document)).toMatchSnapshot(); | ||
}); | ||
it('does not crash with inline elements (e.g. hyperlink)', function () { | ||
@@ -134,0 +138,0 @@ var document = documents_1.hyperlinkDoc; |
@@ -36,2 +36,6 @@ "use strict"; | ||
_a[rich_text_types_1.BLOCKS.HR] = function () { return react_1.default.createElement("hr", null); }, | ||
_a[rich_text_types_1.BLOCKS.TABLE] = function (node, children) { return react_1.default.createElement("table", null, | ||
react_1.default.createElement("tbody", null, children)); }, | ||
_a[rich_text_types_1.BLOCKS.TABLE_ROW] = function (node, children) { return react_1.default.createElement("tr", null, children); }, | ||
_a[rich_text_types_1.BLOCKS.TABLE_CELL] = function (node, children) { return react_1.default.createElement("td", null, children); }, | ||
_a[rich_text_types_1.INLINES.ASSET_HYPERLINK] = function (node) { return defaultInline(rich_text_types_1.INLINES.ASSET_HYPERLINK, node); }, | ||
@@ -38,0 +42,0 @@ _a[rich_text_types_1.INLINES.ENTRY_HYPERLINK] = function (node) { return defaultInline(rich_text_types_1.INLINES.ENTRY_HYPERLINK, node); }, |
@@ -148,15 +148,93 @@ 'use strict'; | ||
// `ToPrimitive` abstract operation | ||
// https://tc39.es/ecma262/#sec-toprimitive | ||
// instead of the ES6 spec version, we didn't implement @@toPrimitive case | ||
// and the second argument - flag - preferred type is a string | ||
var toPrimitive = function (input, PREFERRED_STRING) { | ||
if (!isObject(input)) return input; | ||
var aFunction = function (variable) { | ||
return typeof variable == 'function' ? variable : undefined; | ||
}; | ||
var getBuiltIn = function (namespace, method) { | ||
return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method]; | ||
}; | ||
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; | ||
var process = global_1.process; | ||
var Deno = global_1.Deno; | ||
var versions = process && process.versions || Deno && Deno.version; | ||
var v8 = versions && versions.v8; | ||
var match, version; | ||
if (v8) { | ||
match = v8.split('.'); | ||
version = match[0] < 4 ? 1 : match[0] + match[1]; | ||
} else if (engineUserAgent) { | ||
match = engineUserAgent.match(/Edge\/(\d+)/); | ||
if (!match || match[1] >= 74) { | ||
match = engineUserAgent.match(/Chrome\/(\d+)/); | ||
if (match) version = match[1]; | ||
} | ||
} | ||
var engineV8Version = version && +version; | ||
/* eslint-disable es/no-symbol -- required for testing */ | ||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing | ||
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { | ||
var symbol = Symbol(); | ||
// Chrome 38 Symbol has incorrect toString conversion | ||
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances | ||
return !String(symbol) || !(Object(symbol) instanceof Symbol) || | ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances | ||
!Symbol.sham && engineV8Version && engineV8Version < 41; | ||
}); | ||
/* eslint-disable es/no-symbol -- required for testing */ | ||
var useSymbolAsUid = nativeSymbol | ||
&& !Symbol.sham | ||
&& typeof Symbol.iterator == 'symbol'; | ||
var isSymbol = useSymbolAsUid ? function (it) { | ||
return typeof it == 'symbol'; | ||
} : function (it) { | ||
var $Symbol = getBuiltIn('Symbol'); | ||
return typeof $Symbol == 'function' && Object(it) instanceof $Symbol; | ||
}; | ||
// `OrdinaryToPrimitive` abstract operation | ||
// https://tc39.es/ecma262/#sec-ordinarytoprimitive | ||
var ordinaryToPrimitive = function (input, pref) { | ||
var fn, val; | ||
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
throw TypeError("Can't convert object to primitive value"); | ||
}; | ||
var setGlobal = function (key, value) { | ||
try { | ||
// eslint-disable-next-line es/no-object-defineproperty -- safe | ||
Object.defineProperty(global_1, key, { value: value, configurable: true, writable: true }); | ||
} catch (error) { | ||
global_1[key] = value; | ||
} return value; | ||
}; | ||
var SHARED = '__core-js_shared__'; | ||
var store = global_1[SHARED] || setGlobal(SHARED, {}); | ||
var sharedStore = store; | ||
var shared = createCommonjsModule(function (module) { | ||
(module.exports = function (key, value) { | ||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); | ||
})('versions', []).push({ | ||
version: '3.16.0', | ||
mode: 'global', | ||
copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
}); | ||
}); | ||
// `ToObject` abstract operation | ||
@@ -174,2 +252,48 @@ // https://tc39.es/ecma262/#sec-toobject | ||
var id = 0; | ||
var postfix = Math.random(); | ||
var uid = function (key) { | ||
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); | ||
}; | ||
var WellKnownSymbolsStore = shared('wks'); | ||
var Symbol$1 = global_1.Symbol; | ||
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; | ||
var wellKnownSymbol = function (name) { | ||
if (!has(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { | ||
if (nativeSymbol && has(Symbol$1, name)) { | ||
WellKnownSymbolsStore[name] = Symbol$1[name]; | ||
} else { | ||
WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
} | ||
} return WellKnownSymbolsStore[name]; | ||
}; | ||
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); | ||
// `ToPrimitive` abstract operation | ||
// https://tc39.es/ecma262/#sec-toprimitive | ||
var toPrimitive = function (input, pref) { | ||
if (!isObject(input) || isSymbol(input)) return input; | ||
var exoticToPrim = input[TO_PRIMITIVE]; | ||
var result; | ||
if (exoticToPrim !== undefined) { | ||
if (pref === undefined) pref = 'default'; | ||
result = exoticToPrim.call(input, pref); | ||
if (!isObject(result) || isSymbol(result)) return result; | ||
throw TypeError("Can't convert object to primitive value"); | ||
} | ||
if (pref === undefined) pref = 'number'; | ||
return ordinaryToPrimitive(input, pref); | ||
}; | ||
// `ToPropertyKey` abstract operation | ||
// https://tc39.es/ecma262/#sec-topropertykey | ||
var toPropertyKey = function (argument) { | ||
var key = toPrimitive(argument, 'string'); | ||
return isSymbol(key) ? key : String(key); | ||
}; | ||
var document$1 = global_1.document; | ||
@@ -198,3 +322,3 @@ // typeof document.createElement is 'object' in old IE | ||
O = toIndexedObject(O); | ||
P = toPrimitive(P, true); | ||
P = toPropertyKey(P); | ||
if (ie8DomDefine) try { | ||
@@ -223,3 +347,3 @@ return $getOwnPropertyDescriptor(O, P); | ||
anObject(O); | ||
P = toPrimitive(P, true); | ||
P = toPropertyKey(P); | ||
anObject(Attributes); | ||
@@ -245,15 +369,2 @@ if (ie8DomDefine) try { | ||
var setGlobal = function (key, value) { | ||
try { | ||
createNonEnumerableProperty(global_1, key, value); | ||
} catch (error) { | ||
global_1[key] = value; | ||
} return value; | ||
}; | ||
var SHARED = '__core-js_shared__'; | ||
var store = global_1[SHARED] || setGlobal(SHARED, {}); | ||
var sharedStore = store; | ||
var functionToString = Function.toString; | ||
@@ -274,19 +385,2 @@ | ||
var shared = createCommonjsModule(function (module) { | ||
(module.exports = function (key, value) { | ||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); | ||
})('versions', []).push({ | ||
version: '3.14.0', | ||
mode: 'global', | ||
copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
}); | ||
}); | ||
var id = 0; | ||
var postfix = Math.random(); | ||
var uid = function (key) { | ||
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); | ||
}; | ||
var keys = shared('keys'); | ||
@@ -395,13 +489,2 @@ | ||
var path = global_1; | ||
var aFunction = function (variable) { | ||
return typeof variable == 'function' ? variable : undefined; | ||
}; | ||
var getBuiltIn = function (namespace, method) { | ||
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) | ||
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; | ||
}; | ||
var ceil = Math.ceil; | ||
@@ -649,59 +732,6 @@ var floor = Math.floor; | ||
var path = global_1; | ||
var values = path.Object.values; | ||
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; | ||
var process = global_1.process; | ||
var versions = process && process.versions; | ||
var v8 = versions && versions.v8; | ||
var match, version; | ||
if (v8) { | ||
match = v8.split('.'); | ||
version = match[0] < 4 ? 1 : match[0] + match[1]; | ||
} else if (engineUserAgent) { | ||
match = engineUserAgent.match(/Edge\/(\d+)/); | ||
if (!match || match[1] >= 74) { | ||
match = engineUserAgent.match(/Chrome\/(\d+)/); | ||
if (match) version = match[1]; | ||
} | ||
} | ||
var engineV8Version = version && +version; | ||
/* eslint-disable es/no-symbol -- required for testing */ | ||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing | ||
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { | ||
var symbol = Symbol(); | ||
// Chrome 38 Symbol has incorrect toString conversion | ||
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances | ||
return !String(symbol) || !(Object(symbol) instanceof Symbol) || | ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances | ||
!Symbol.sham && engineV8Version && engineV8Version < 41; | ||
}); | ||
/* eslint-disable es/no-symbol -- required for testing */ | ||
var useSymbolAsUid = nativeSymbol | ||
&& !Symbol.sham | ||
&& typeof Symbol.iterator == 'symbol'; | ||
var WellKnownSymbolsStore = shared('wks'); | ||
var Symbol$1 = global_1.Symbol; | ||
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; | ||
var wellKnownSymbol = function (name) { | ||
if (!has(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { | ||
if (nativeSymbol && has(Symbol$1, name)) { | ||
WellKnownSymbolsStore[name] = Symbol$1[name]; | ||
} else { | ||
WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
} | ||
} return WellKnownSymbolsStore[name]; | ||
}; | ||
// `Object.defineProperties` method | ||
@@ -722,2 +752,11 @@ // https://tc39.es/ecma262/#sec-object.defineproperties | ||
/* global ActiveXObject -- old IE, WSH */ | ||
var GT = '>'; | ||
@@ -750,11 +789,13 @@ var LT = '<'; | ||
var iframeDocument; | ||
iframe.style.display = 'none'; | ||
html.appendChild(iframe); | ||
// https://github.com/zloirock/core-js/issues/475 | ||
iframe.src = String(JS); | ||
iframeDocument = iframe.contentWindow.document; | ||
iframeDocument.open(); | ||
iframeDocument.write(scriptTag('document.F=Object')); | ||
iframeDocument.close(); | ||
return iframeDocument.F; | ||
if (iframe.style) { | ||
iframe.style.display = 'none'; | ||
html.appendChild(iframe); | ||
// https://github.com/zloirock/core-js/issues/475 | ||
iframe.src = String(JS); | ||
iframeDocument = iframe.contentWindow.document; | ||
iframeDocument.open(); | ||
iframeDocument.write(scriptTag('document.F=Object')); | ||
iframeDocument.close(); | ||
return iframeDocument.F; | ||
} | ||
}; | ||
@@ -770,6 +811,8 @@ | ||
try { | ||
/* global ActiveXObject -- old IE */ | ||
activeXDocument = document.domain && new ActiveXObject('htmlfile'); | ||
activeXDocument = new ActiveXObject('htmlfile'); | ||
} catch (error) { /* ignore */ } | ||
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); | ||
NullProtoObject = document.domain && activeXDocument ? | ||
NullProtoObjectViaActiveX(activeXDocument) : // old IE | ||
NullProtoObjectViaIFrame() || | ||
NullProtoObjectViaActiveX(activeXDocument); // WSH | ||
var length = enumBugKeys.length; | ||
@@ -905,8 +948,10 @@ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; | ||
*/ | ||
var marks = { | ||
BOLD: 'bold', | ||
ITALIC: 'italic', | ||
UNDERLINE: 'underline', | ||
CODE: 'code', | ||
}; | ||
var MARKS; | ||
(function (MARKS) { | ||
MARKS["BOLD"] = "bold"; | ||
MARKS["ITALIC"] = "italic"; | ||
MARKS["UNDERLINE"] = "underline"; | ||
MARKS["CODE"] = "code"; | ||
})(MARKS || (MARKS = {})); | ||
var MARKS$1 = MARKS; | ||
@@ -1003,3 +1048,3 @@ var _a; | ||
exports.INLINES = INLINES$1; | ||
exports.MARKS = marks; | ||
exports.MARKS = MARKS$1; | ||
exports.TOP_LEVEL_BLOCKS = TOP_LEVEL_BLOCKS; | ||
@@ -1068,2 +1113,6 @@ exports.VOID_BLOCKS = VOID_BLOCKS; | ||
_a[richTextTypes_es5_1.HR] = function () { return React__default.createElement("hr", null); }, | ||
_a[richTextTypes_es5_1.TABLE] = function (node, children) { return React__default.createElement("table", null, | ||
React__default.createElement("tbody", null, children)); }, | ||
_a[richTextTypes_es5_1.TABLE_ROW] = function (node, children) { return React__default.createElement("tr", null, children); }, | ||
_a[richTextTypes_es5_1.TABLE_CELL] = function (node, children) { return React__default.createElement("td", null, children); }, | ||
_a[richTextTypes_es5_4.ASSET_HYPERLINK] = function (node) { return defaultInline(richTextTypes_es5_4.ASSET_HYPERLINK, node); }, | ||
@@ -1070,0 +1119,0 @@ _a[richTextTypes_es5_4.ENTRY_HYPERLINK] = function (node) { return defaultInline(richTextTypes_es5_4.ENTRY_HYPERLINK, node); }, |
@@ -14,1 +14,2 @@ export { default as hrDoc } from './hr'; | ||
export { default as quoteDoc } from './quote'; | ||
export { default as tableDoc } from './table'; |
{ | ||
"name": "@contentful/rich-text-react-renderer", | ||
"version": "15.0.0", | ||
"version": "15.1.0", | ||
"main": "dist/rich-text-react-renderer.es5.js", | ||
@@ -27,3 +27,3 @@ "typings": "dist/types/index.d.ts", | ||
"dependencies": { | ||
"@contentful/rich-text-types": "^15.0.0" | ||
"@contentful/rich-text-types": "^15.1.0" | ||
}, | ||
@@ -51,3 +51,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "be7ebb0ce035f7646370ac1dab0233cbdac01b1e" | ||
"gitHead": "9cbd4f6888ee8c94f970923afdfadd91d7f049cb" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
192335
72
2105
2