Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/contentful-slatejs-adapter

Package Overview
Dependencies
Maintainers
49
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/contentful-slatejs-adapter - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

32

dist/contentful-slatejs-adapter.es5.js

@@ -11,2 +11,28 @@ 'use strict';

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function toSlatejsDocument(_a) {

@@ -43,3 +69,3 @@ var document = _a.document, _b = _a.schema, schema = _b === void 0 ? {} : _b;

case 'text':
var _a = node, marks = _a.marks, value = _a.value, data = _a.data;
var _a = node, _b = _a.marks, marks = _b === void 0 ? [] : _b, value = _a.value, data = _a.data;
var slateText = {

@@ -51,3 +77,3 @@ object: 'text',

text: value,
marks: marks,
marks: marks.map(function (mark) { return (__assign({}, mark, { data: {}, object: 'mark' })); }),
},

@@ -105,3 +131,3 @@ ],

value: leaf.text,
marks: leaf.marks || [],
marks: leaf.marks ? leaf.marks.map(function (mark) { return ({ type: mark.type }); }) : [],
data: node.data,

@@ -108,0 +134,0 @@ }); });

2

dist/lib/__test__/contentful-to-slatejs-adapter.test.js

@@ -31,3 +31,3 @@ "use strict";

testAdapters('paragraph with text', contentful.document(contentful.block('paragraph', contentful.text('hi'))), slate.document(slate.block('paragraph', false, slate.text(slate.leaf('hi')))));
testAdapters('text with marks', contentful.document(contentful.block('paragraph', contentful.text('this'), contentful.text('is', contentful.mark('bold')))), slate.document(slate.block('paragraph', false, slate.text(slate.leaf('this')), slate.text(slate.leaf('is', contentful.mark('bold'))))));
testAdapters('text with marks', contentful.document(contentful.block('paragraph', contentful.text('this'), contentful.text('is', contentful.mark('bold')))), slate.document(slate.block('paragraph', false, slate.text(slate.leaf('this')), slate.text(slate.leaf('is', slate.mark('bold'))))));
it('adds a default value to marks if undefined', function () {

@@ -34,0 +34,0 @@ var slateDoc = slate.document(slate.block('paragraph', false, slate.text({ marks: undefined, object: 'leaf', text: 'Hi' })));

@@ -63,5 +63,7 @@ "use strict";

exports.leaf = leaf;
function mark(type) {
function mark(type, data) {
return {
type: type,
data: data || {},
object: 'mark',
};

@@ -68,0 +70,0 @@ }

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -37,3 +45,3 @@ var lodash_flatmap_1 = require("lodash.flatmap");

case 'text':
var _a = node, marks = _a.marks, value = _a.value, data = _a.data;
var _a = node, _b = _a.marks, marks = _b === void 0 ? [] : _b, value = _a.value, data = _a.data;
var slateText = {

@@ -45,3 +53,3 @@ object: 'text',

text: value,
marks: marks,
marks: marks.map(function (mark) { return (__assign({}, mark, { data: {}, object: 'mark' })); }),
},

@@ -48,0 +56,0 @@ ],

@@ -42,3 +42,3 @@ "use strict";

value: leaf.text,
marks: leaf.marks || [],
marks: leaf.marks ? leaf.marks.map(function (mark) { return ({ type: mark.type }); }) : [],
data: node.data,

@@ -45,0 +45,0 @@ }); });

@@ -6,2 +6,2 @@ export declare function document(...nodes: Slate.Block[]): Slate.Document;

export declare function leaf(value: string, ...marks: Slate.Mark[]): Slate.TextLeaf;
export declare function mark(type: string): Slate.Mark;
export declare function mark(type: string, data?: Record<string, any>): Slate.Mark;

@@ -26,2 +26,4 @@ declare namespace Slate {

type: string;
data: Record<string, any>;
object: 'mark';
}

@@ -28,0 +30,0 @@ interface TextLeaf {

{
"name": "@contentful/contentful-slatejs-adapter",
"version": "3.0.0",
"version": "3.1.0",
"description": "",

@@ -123,3 +123,3 @@ "keywords": [],

"dependencies": {
"@contentful/structured-text-types": "^2.0.0",
"@contentful/structured-text-types": "^3.2.0",
"lodash.flatmap": "^4.5.0",

@@ -126,0 +126,0 @@ "lodash.get": "^4.4.2",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc