New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

slate-serializers

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slate-serializers - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

lib/config/slateToReact/default.js

@@ -9,4 +9,4 @@ "use strict";

const nanoid_1 = require("nanoid");
const BlockQuote = ({ children }) => react_1.default.createElement("blockquote", null,
react_1.default.createElement("p", null, children));
const BlockQuote = ({ children }) => (react_1.default.createElement("blockquote", null,
react_1.default.createElement("p", null, children)));
exports.config = {

@@ -22,5 +22,5 @@ elementTransforms: {

}
return react_1.default.createElement("a", { key: (0, nanoid_1.nanoid)(), href: node.url, ...attrs }, children);
return (react_1.default.createElement("a", { key: (0, nanoid_1.nanoid)(), href: node.url, ...attrs }, children));
},
},
};

@@ -26,5 +26,5 @@ "use strict";

}
return react_1.default.createElement("a", { href: node.url, ...attrs }, children);
return (react_1.default.createElement("a", { href: node.url, ...attrs }, children));
},
},
};

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

if (config.textTags[nodeName] || el.type === htmlparser2_1.ElementType.Text) {
const attrs = gatherTextMarkAttributes({ el: currentEl });
const attrs = gatherTextMarkAttributes({ el: currentEl, config });
const text = (0, whitespace_1.processTextValue)({

@@ -63,0 +63,0 @@ text: (0, domutils_1.textContent)(el),

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

},
wrapChildren: (children) => children
wrapChildren: (children) => children,
}));

@@ -33,0 +33,0 @@ return document;

import { Element, Text } from 'domhandler';
import { Config } from '../config/slateToDom/types';
interface IconvertSlate {
interface IConvertSlate {
node: any;

@@ -12,3 +12,3 @@ config?: Config;

}
export declare const convertSlate: ({ node, config, isLastNodeInDocument, customElementTransforms, transformText, transformElement, wrapChildren, }: IconvertSlate) => any;
export declare const convertSlate: ({ node, config, isLastNodeInDocument, customElementTransforms, transformText, transformElement, wrapChildren, }: IConvertSlate) => any;
export {};

@@ -18,12 +18,10 @@ "use strict";

if (slate_1.Text.isText(node)) {
const str = config.alwaysEncodeBreakingEntities && config.encodeEntities === false
? (0, _1.encodeBreakingEntities)(node.text)
: node.text;
// convert line breaks to br tags
const str = config.alwaysEncodeBreakingEntities && !config.encodeEntities ? (0, _1.encodeBreakingEntities)(node.text) : node.text;
const strLines = config.convertLineBreakToBr ? str.split('\n') : [str];
const textChildren = [];
// convert line breaks to br tags
strLines.forEach((line, index) => {
const markElements = [];
const markTransformKeys = (0, _2.intersection)(config.markTransforms || {}, node);
markTransformKeys.map((key) => {
markTransformKeys.forEach((key) => {
var _a;

@@ -38,3 +36,2 @@ if ((_a = config.markTransforms) === null || _a === void 0 ? void 0 : _a[key]) {

var _a;
// more complex transforms
if ((_a = config.markTransforms) === null || _a === void 0 ? void 0 : _a[tagName]) {

@@ -52,3 +49,3 @@ return config.markTransforms[tagName]({ node, attribs: {} });

if (config.alwaysEncodeCodeEntities &&
config.encodeEntities === false &&
!config.encodeEntities &&
(0, domhandler_1.isTag)(textElement) &&

@@ -103,3 +100,3 @@ (0, domutils_1.getName)(textElement) === 'pre') {

}
// straightforward node to element
// straightforward node to element mapping
if (!element && config.elementMap[node.type]) {

@@ -106,0 +103,0 @@ element = transformElement(new domhandler_1.Element(config.elementMap[node.type], attribs, children));

{
"name": "slate-serializers",
"version": "0.4.0",
"version": "0.4.1",
"description": "Serialize Slate JSON objects to HTML and vice versa. Define rules to modify the end result.",

@@ -9,3 +9,3 @@ "main": "lib/index.js",

"build": "tsc",
"format": "prettier --write \"{src,__tests__}/**/*.ts\"",
"format": "npx prettier --write .",
"lint": "tslint -p tsconfig.json",

@@ -44,3 +44,3 @@ "release": "standard-version",

"postcss-js": "^4.0.1",
"prettier": "^2.8.8",
"prettier": "2.8.8",
"react-test-renderer": "^18.2.0",

@@ -47,0 +47,0 @@ "ts-jest": "^29.1.0",

@@ -156,3 +156,3 @@ # slate-serializers

TLDR: contributors can format commit messages in any way, maintainers should use conventional commits.
TLDR: contributors can format commit messages in any way, maintainers should use conventional commits.

@@ -166,2 +166,2 @@ This repository uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).

Run `npx cz` instead of `git commit` to lint commit messages using [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli).
Run `npx cz` instead of `git commit` to lint commit messages using [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli).
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