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

@cloudbeds/slate-serializers

Package Overview
Dependencies
Maintainers
59
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudbeds/slate-serializers - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

1

lib/config/slateToDom/default.js

@@ -49,4 +49,5 @@ "use strict";

encodeEntities: true,
alwaysEncodeBreakingEntities: false,
alwaysEncodeCodeEntities: false,
convertLineBreakToBr: false,
};

@@ -24,2 +24,3 @@ import { ChildNode, Element } from 'domhandler';

encodeEntities?: boolean;
alwaysEncodeBreakingEntities?: boolean;
alwaysEncodeCodeEntities?: boolean;

@@ -26,0 +27,0 @@ convertLineBreakToBr?: boolean;

4

lib/serializers/htmlToSlate/index.js

@@ -23,4 +23,3 @@ "use strict";

const isLastChild = index === childrenLength - 1;
const isWithinTextNodes = (((_a = currentEl.prev) === null || _a === void 0 ? void 0 : _a.type) === htmlparser2_1.ElementType.Text
&& ((_b = currentEl.next) === null || _b === void 0 ? void 0 : _b.type) === htmlparser2_1.ElementType.Text);
const isWithinTextNodes = ((_a = currentEl.prev) === null || _a === void 0 ? void 0 : _a.type) === htmlparser2_1.ElementType.Text && ((_b = currentEl.next) === null || _b === void 0 ? void 0 : _b.type) === htmlparser2_1.ElementType.Text;
if (nodeName === 'br' && config.convertBrToLineBreak && context !== 'preserve') {

@@ -94,2 +93,3 @@ return [(0, slate_hyperscript_1.jsx)('text', { text: context ? '\n' : '' }, [])];

if (children.length) {
;
[el, ...children.flat()].forEach((child) => {

@@ -96,0 +96,0 @@ const name = (0, domutils_1.getName)(child);

@@ -29,3 +29,5 @@ "use strict";

if (slate_1.Text.isText(node)) {
const str = node.text;
const str = config.alwaysEncodeBreakingEntities && config.encodeEntities === false
? (0, utilities_1.encodeBreakingEntities)(node.text)
: node.text;
// convert line breaks to br tags

@@ -32,0 +34,0 @@ const strLines = config.convertLineBreakToBr ? str.split('\n') : [str];

@@ -18,1 +18,2 @@ export declare const hasLineBreak: (str: string) => boolean;

export declare const getNested: (obj: any, ...args: string[]) => any;
export declare const encodeBreakingEntities: (str: string) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNested = exports.removeEmpty = exports.isEmptyObject = exports.styleToString = exports.parseStyleCssText = exports.prependSpace = exports.hasLineBreak = void 0;
exports.encodeBreakingEntities = exports.getNested = exports.removeEmpty = exports.isEmptyObject = exports.styleToString = exports.parseStyleCssText = exports.prependSpace = exports.hasLineBreak = void 0;
const hasLineBreak = (str) => str.match(/[\r\n]+/) !== null;

@@ -58,1 +58,21 @@ exports.hasLineBreak = hasLineBreak;

exports.getNested = getNested;
const encodeBreakingEntities = (str) => {
const swapChar = (charToSwap) => {
// that swaps characters to HTML entities
switch (charToSwap) {
case '&':
return '&';
case '<':
return '&lt;';
case '>':
return '&gt;';
default:
return charToSwap;
}
};
str = str.replace(/[&<>]/g, (match) => {
return swapChar(match);
});
return str;
};
exports.encodeBreakingEntities = encodeBreakingEntities;
{
"name": "@cloudbeds/slate-serializers",
"version": "1.0.1",
"version": "1.1.0",
"description": "Serialize Slate JSON objects to HTML and vice versa. Define rules to modify the end result.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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