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

@udecode/plate-normalizers

Package Overview
Dependencies
Maintainers
2
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/plate-normalizers - npm Package Compare versions

Comparing version 7.0.2 to 8.0.0

dist/withNormalizeTypes.d.ts

2

CHANGELOG.md
# @udecode/plate-normalizers
## 8.0.0
## 7.0.2

@@ -4,0 +6,0 @@

11

dist/createNormalizeTypesPlugin.d.ts

@@ -1,3 +0,2 @@

import { ErrorHandler } from '@udecode/plate-common';
import { WithOverride } from '@udecode/plate-core';
import { ErrorHandler } from '@udecode/plate-core';
import { Path } from 'slate';

@@ -18,3 +17,3 @@ interface Rule {

}
export interface NormalizeTypesPluginOptions extends ErrorHandler {
export interface NormalizeTypesPlugin extends ErrorHandler {
/**

@@ -28,10 +27,10 @@ * Set of rules for the types.

*/
rules: Rule[];
rules?: Rule[];
}
export declare const withNormalizeTypes: ({ rules, onError, }: NormalizeTypesPluginOptions) => WithOverride;
export declare const KEY_NORMALIZE_TYPES = "normalizeTypes";
/**
* @see {@link withNormalizeTypes}
*/
export declare const createNormalizeTypesPlugin: (options_0: NormalizeTypesPluginOptions) => import("@udecode/plate-core").PlatePlugin<{}>;
export declare const createNormalizeTypesPlugin: <T = {}>(override?: Partial<import("@udecode/plate-core").PlatePlugin<T, NormalizeTypesPlugin>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<T> | undefined) => import("@udecode/plate-core").PlatePlugin<T, NormalizeTypesPlugin>;
export {};
//# sourceMappingURL=createNormalizeTypesPlugin.d.ts.map

@@ -1,14 +0,8 @@

import { WithOverride } from '@udecode/plate-core';
export interface RemoveEmptyNodesPlugin {
types?: string | string[];
}
/**
* Remove nodes with empty text.
*/
export declare const withRemoveEmptyNodes: (options: {
type: string | string[];
}) => WithOverride;
/**
* @see {@link withRemoveEmptyNodes}
*/
export declare const createRemoveEmptyNodesPlugin: (options: {
type: string | string[];
}) => import("@udecode/plate-core").PlatePlugin<{}>;
export declare const createRemoveEmptyNodesPlugin: <T = {}>(override?: Partial<import("@udecode/plate-core").PlatePlugin<T, RemoveEmptyNodesPlugin>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<T> | undefined) => import("@udecode/plate-core").PlatePlugin<T, RemoveEmptyNodesPlugin>;
//# sourceMappingURL=createRemoveEmptyNodesPlugin.d.ts.map

@@ -6,2 +6,4 @@ /**

export * from './createRemoveEmptyNodesPlugin';
export * from './withNormalizeTypes';
export * from './withRemoveEmptyNodes';
//# sourceMappingURL=index.d.ts.map

@@ -1,9 +0,10 @@

import { getNode, setNodes, insertNodes } from '@udecode/plate-common';
import { isElement, getPlatePluginWithOverrides } from '@udecode/plate-core';
import { getNode, isElement, setNodes, insertNodes, createPluginFactory } from '@udecode/plate-core';
import { Node, Transforms } from 'slate';
const withNormalizeTypes = ({
rules,
onError
}) => editor => {
const withNormalizeTypes = (editor, {
options: {
rules,
onError
}
}) => {
const {

@@ -60,2 +61,4 @@ normalizeNode

};
const KEY_NORMALIZE_TYPES = 'normalizeTypes';
/**

@@ -65,3 +68,9 @@ * @see {@link withNormalizeTypes}

const createNormalizeTypesPlugin = getPlatePluginWithOverrides(withNormalizeTypes);
const createNormalizeTypesPlugin = createPluginFactory({
key: KEY_NORMALIZE_TYPES,
withOverrides: withNormalizeTypes,
options: {
rules: []
}
});

@@ -141,5 +150,8 @@ /**

*/
const withRemoveEmptyNodes = options => editor => {
const types = castArray_1(options.type);
const withRemoveEmptyNodes = (editor, {
options: {
types: _types
}
}) => {
const types = castArray_1(_types);
const {

@@ -162,9 +174,12 @@ normalizeNode

};
/**
* @see {@link withRemoveEmptyNodes}
*/
const createRemoveEmptyNodesPlugin = createPluginFactory({
key: 'removeEmptyNodes',
withOverrides: withRemoveEmptyNodes
});
const createRemoveEmptyNodesPlugin = getPlatePluginWithOverrides(withRemoveEmptyNodes);
export { createNormalizeTypesPlugin, createRemoveEmptyNodesPlugin, withNormalizeTypes, withRemoveEmptyNodes };
export { KEY_NORMALIZE_TYPES, createNormalizeTypesPlugin, createRemoveEmptyNodesPlugin, withNormalizeTypes, withRemoveEmptyNodes };
//# sourceMappingURL=index.es.js.map

@@ -5,10 +5,11 @@ 'use strict';

var plateCommon = require('@udecode/plate-common');
var plateCore = require('@udecode/plate-core');
var slate = require('slate');
const withNormalizeTypes = ({
rules,
onError
}) => editor => {
const withNormalizeTypes = (editor, {
options: {
rules,
onError
}
}) => {
const {

@@ -25,7 +26,7 @@ normalizeNode

}) => {
const node = plateCommon.getNode(editor, path);
const node = plateCore.getNode(editor, path);
if (node) {
if (strictType && plateCore.isElement(node) && node.type !== strictType) {
plateCommon.setNodes(editor, {
plateCore.setNodes(editor, {
type: strictType

@@ -39,3 +40,3 @@ }, {

try {
plateCommon.insertNodes(editor, {
plateCore.insertNodes(editor, {
type: strictType !== null && strictType !== void 0 ? strictType : type,

@@ -67,2 +68,4 @@ children: [{

};
const KEY_NORMALIZE_TYPES = 'normalizeTypes';
/**

@@ -72,3 +75,9 @@ * @see {@link withNormalizeTypes}

const createNormalizeTypesPlugin = plateCore.getPlatePluginWithOverrides(withNormalizeTypes);
const createNormalizeTypesPlugin = plateCore.createPluginFactory({
key: KEY_NORMALIZE_TYPES,
withOverrides: withNormalizeTypes,
options: {
rules: []
}
});

@@ -148,5 +157,8 @@ /**

*/
const withRemoveEmptyNodes = options => editor => {
const types = castArray_1(options.type);
const withRemoveEmptyNodes = (editor, {
options: {
types: _types
}
}) => {
const types = castArray_1(_types);
const {

@@ -169,8 +181,12 @@ normalizeNode

};
/**
* @see {@link withRemoveEmptyNodes}
*/
const createRemoveEmptyNodesPlugin = plateCore.createPluginFactory({
key: 'removeEmptyNodes',
withOverrides: withRemoveEmptyNodes
});
const createRemoveEmptyNodesPlugin = plateCore.getPlatePluginWithOverrides(withRemoveEmptyNodes);
exports.KEY_NORMALIZE_TYPES = KEY_NORMALIZE_TYPES;
exports.createNormalizeTypesPlugin = createNormalizeTypesPlugin;

@@ -177,0 +193,0 @@ exports.createRemoveEmptyNodesPlugin = createRemoveEmptyNodesPlugin;

{
"name": "@udecode/plate-normalizers",
"version": "7.0.2",
"version": "8.0.0",
"description": "Normalizer plugins for Plate",

@@ -35,4 +35,3 @@ "keywords": [

"dependencies": {
"@udecode/plate-common": "7.0.2",
"@udecode/plate-core": "7.0.2"
"@udecode/plate-core": "8.0.0"
},

@@ -39,0 +38,0 @@ "peerDependencies": {

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