@contentful/contentful-slatejs-adapter
Advanced tools
Comparing version 15.16.0 to 15.16.2
@@ -5,8 +5,4 @@ 'use strict'; | ||
var flatmap = require('lodash.flatmap'); | ||
var get = require('lodash.get'); | ||
var Contentful = require('@contentful/rich-text-types'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
@@ -30,4 +26,2 @@ if (e && e.__esModule) return e; | ||
var flatmap__default = /*#__PURE__*/_interopDefaultLegacy(flatmap); | ||
var get__default = /*#__PURE__*/_interopDefaultLegacy(get); | ||
var Contentful__namespace = /*#__PURE__*/_interopNamespace(Contentful); | ||
@@ -96,4 +90,6 @@ | ||
isVoid: function (node) { | ||
var _a, _b, _c; | ||
var root = Object.values(Contentful.BLOCKS).includes(node.nodeType) ? 'blocks' : 'inlines'; | ||
return get__default["default"](schema, [root, node.nodeType, 'isVoid'], false); | ||
// tslint:disable-next-line | ||
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema[root]) === null || _a === void 0 ? void 0 : _a[node.nodeType]) === null || _b === void 0 ? void 0 : _b['isVoid']) !== null && _c !== void 0 ? _c : false; | ||
}, | ||
@@ -112,3 +108,3 @@ isTextContainer: function (nodeType) { | ||
// this will be a compatibility problem for existing users. | ||
return flatmap__default["default"](document.content, function (node) { return convertNode$1(node, fromJSON(schema)); }); | ||
return document.content.flatMap(function (node) { return convertNode$1(node, fromJSON(schema)); }); | ||
} | ||
@@ -121,3 +117,3 @@ function convertNode$1(node, schema) { | ||
var contentfulNode = node; | ||
var childNodes = flatmap__default["default"](contentfulNode.content, function (childNode) { | ||
var childNodes = contentfulNode.content.flatMap(function (childNode) { | ||
return convertNode$1(childNode, schema); | ||
@@ -161,3 +157,3 @@ }); | ||
data: {}, | ||
content: flatmap__default["default"](document, function (node) { return convertNode(node, fromJSON(schema)); }), | ||
content: document.flatMap(function (node) { return convertNode(node, fromJSON(schema)); }), | ||
}; | ||
@@ -174,3 +170,3 @@ } | ||
if (!schema.isVoid(contentfulElement)) { | ||
contentfulElement.content = flatmap__default["default"](node.children, function (childNode) { | ||
contentfulElement.content = node.children.flatMap(function (childNode) { | ||
return convertNode(childNode, schema); | ||
@@ -177,0 +173,0 @@ }); |
@@ -12,3 +12,2 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import flatmap from 'lodash.flatmap'; | ||
import { getDataOrDefault } from './helpers'; | ||
@@ -22,3 +21,3 @@ import { fromJSON } from './schema'; | ||
// this will be a compatibility problem for existing users. | ||
return flatmap(document.content, function (node) { return convertNode(node, fromJSON(schema)); }); | ||
return document.content.flatMap(function (node) { return convertNode(node, fromJSON(schema)); }); | ||
} | ||
@@ -31,3 +30,3 @@ function convertNode(node, schema) { | ||
var contentfulNode = node; | ||
var childNodes = flatmap(contentfulNode.content, function (childNode) { | ||
var childNodes = contentfulNode.content.flatMap(function (childNode) { | ||
return convertNode(childNode, schema); | ||
@@ -34,0 +33,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
import get from 'lodash.get'; | ||
import { BLOCKS, TEXT_CONTAINERS } from '@contentful/rich-text-types'; | ||
@@ -21,4 +20,6 @@ var defaultSchema = {}; | ||
isVoid: function (node) { | ||
var _a, _b, _c; | ||
var root = Object.values(BLOCKS).includes(node.nodeType) ? 'blocks' : 'inlines'; | ||
return get(schema, [root, node.nodeType, 'isVoid'], false); | ||
// tslint:disable-next-line | ||
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema[root]) === null || _a === void 0 ? void 0 : _a[node.nodeType]) === null || _b === void 0 ? void 0 : _b['isVoid']) !== null && _c !== void 0 ? _c : false; | ||
}, | ||
@@ -25,0 +26,0 @@ isTextContainer: function (nodeType) { |
@@ -12,3 +12,2 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
import flatMap from 'lodash.flatmap'; | ||
import { getDataOrDefault } from './helpers'; | ||
@@ -26,3 +25,3 @@ import { fromJSON } from './schema'; | ||
data: {}, | ||
content: flatMap(document, function (node) { return convertNode(node, fromJSON(schema)); }), | ||
content: document.flatMap(function (node) { return convertNode(node, fromJSON(schema)); }), | ||
}; | ||
@@ -39,3 +38,3 @@ } | ||
if (!schema.isVoid(contentfulElement)) { | ||
contentfulElement.content = flatMap(node.children, function (childNode) { | ||
contentfulElement.content = node.children.flatMap(function (childNode) { | ||
return convertNode(childNode, schema); | ||
@@ -42,0 +41,0 @@ }); |
{ | ||
"name": "@contentful/contentful-slatejs-adapter", | ||
"version": "15.16.0", | ||
"version": "15.16.2", | ||
"description": "", | ||
@@ -27,7 +27,7 @@ "keywords": [], | ||
"test:watch": "jest --watch", | ||
"test:prod": "npm run lint && npm run test -- --coverage --no-cache", | ||
"test:prod": "yarn test -- --coverage --no-cache", | ||
"report-coverage": "cat ./coverage/lcov.info | coveralls" | ||
}, | ||
"dependencies": { | ||
"@contentful/rich-text-types": "^16.0.0" | ||
"@contentful/rich-text-types": "^16.0.2" | ||
}, | ||
@@ -62,3 +62,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "7401e7710e173ba2d7340e8f59589a43677f0935" | ||
"gitHead": "c88d249eda1b624ad961b10f4e2ea9365b4b3f4b" | ||
} |
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
67162
939
1