🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@udecode/plate-trailing-block

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/plate-trailing-block - npm Package Compare versions

Comparing version

to
8.0.0

dist/withTrailingBlock.d.ts

2

CHANGELOG.md
# @udecode/plate-trailing-block
## 8.0.0
## 7.0.2

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

20

dist/createTrailingBlockPlugin.d.ts

@@ -1,21 +0,17 @@

import { QueryNodeOptions } from '@udecode/plate-common';
import { WithOverride } from '@udecode/plate-core';
export interface TrailingBlockPluginOptions extends QueryNodeOptions {
import { QueryNodeOptions } from '@udecode/plate-core';
export interface TrailingBlockPlugin extends QueryNodeOptions {
/**
* Level where the trailing node should be, the first level being 0.
*/
level?: number;
/**
* Type of the trailing block
*/
type?: string;
/**
* Level where the trailing node should be, the first level being 0.
*/
level?: number;
}
export declare const KEY_TRAILING_BLOCK = "trailingBlock";
/**
* Add a trailing block when the last node type is not `type` and when the editor has .
*/
export declare const withTrailingBlock: ({ type: _type, level, ...query }?: TrailingBlockPluginOptions) => WithOverride;
/**
* @see {@link withTrailingNode}
*/
export declare const createTrailingBlockPlugin: (options_0?: TrailingBlockPluginOptions | undefined) => import("@udecode/plate-core").PlatePlugin<{}>;
export declare const createTrailingBlockPlugin: <T = {}>(override?: Partial<import("@udecode/plate-core").PlatePlugin<T, TrailingBlockPlugin>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<T> | undefined) => import("@udecode/plate-core").PlatePlugin<T, TrailingBlockPlugin>;
//# sourceMappingURL=createTrailingBlockPlugin.d.ts.map

@@ -5,2 +5,3 @@ /**

export * from './createTrailingBlockPlugin';
export * from './withTrailingBlock';
//# sourceMappingURL=index.d.ts.map

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

import { ELEMENT_DEFAULT, getLastNode, queryNode, insertNodes } from '@udecode/plate-common';
import { getPlatePluginType, getPlatePluginWithOverrides } from '@udecode/plate-core';
import { getLastNode, queryNode, insertNodes, createPluginFactory, getPluginType, ELEMENT_DEFAULT } from '@udecode/plate-core';
import { Path } from 'slate';

@@ -8,11 +7,12 @@

*/
const withTrailingBlock = ({
type: _type,
level = 0,
...query
} = {}) => editor => {
const withTrailingBlock = (editor, {
type,
options: {
level,
...query
}
}) => {
const {
normalizeNode
} = editor;
const type = _type !== null && _type !== void 0 ? _type : getPlatePluginType(editor, ELEMENT_DEFAULT);

@@ -27,3 +27,3 @@ editor.normalizeNode = ([currentNode, currentPath]) => {

insertNodes(editor, {
type,
type: type,
children: [{

@@ -44,2 +44,4 @@ text: ''

};
const KEY_TRAILING_BLOCK = 'trailingBlock';
/**

@@ -49,5 +51,14 @@ * @see {@link withTrailingNode}

const createTrailingBlockPlugin = getPlatePluginWithOverrides(withTrailingBlock);
const createTrailingBlockPlugin = createPluginFactory({
key: KEY_TRAILING_BLOCK,
withOverrides: withTrailingBlock,
options: {
level: 0
},
then: editor => ({
type: getPluginType(editor, ELEMENT_DEFAULT)
})
});
export { createTrailingBlockPlugin, withTrailingBlock };
export { KEY_TRAILING_BLOCK, createTrailingBlockPlugin, withTrailingBlock };
//# sourceMappingURL=index.es.js.map

@@ -5,3 +5,2 @@ 'use strict';

var plateCommon = require('@udecode/plate-common');
var plateCore = require('@udecode/plate-core');

@@ -13,21 +12,22 @@ var slate = require('slate');

*/
const withTrailingBlock = ({
type: _type,
level = 0,
...query
} = {}) => editor => {
const withTrailingBlock = (editor, {
type,
options: {
level,
...query
}
}) => {
const {
normalizeNode
} = editor;
const type = _type !== null && _type !== void 0 ? _type : plateCore.getPlatePluginType(editor, plateCommon.ELEMENT_DEFAULT);
editor.normalizeNode = ([currentNode, currentPath]) => {
if (!currentPath.length) {
const lastChild = plateCommon.getLastNode(editor, level);
const lastChild = plateCore.getLastNode(editor, level);
const lastChildNode = lastChild === null || lastChild === void 0 ? void 0 : lastChild[0];
if (!lastChildNode || lastChildNode.type !== type && plateCommon.queryNode(lastChild, query)) {
if (!lastChildNode || lastChildNode.type !== type && plateCore.queryNode(lastChild, query)) {
const at = lastChild ? slate.Path.next(lastChild[1]) : [0];
plateCommon.insertNodes(editor, {
type,
plateCore.insertNodes(editor, {
type: type,
children: [{

@@ -48,2 +48,4 @@ text: ''

};
const KEY_TRAILING_BLOCK = 'trailingBlock';
/**

@@ -53,6 +55,16 @@ * @see {@link withTrailingNode}

const createTrailingBlockPlugin = plateCore.getPlatePluginWithOverrides(withTrailingBlock);
const createTrailingBlockPlugin = plateCore.createPluginFactory({
key: KEY_TRAILING_BLOCK,
withOverrides: withTrailingBlock,
options: {
level: 0
},
then: editor => ({
type: plateCore.getPluginType(editor, plateCore.ELEMENT_DEFAULT)
})
});
exports.KEY_TRAILING_BLOCK = KEY_TRAILING_BLOCK;
exports.createTrailingBlockPlugin = createTrailingBlockPlugin;
exports.withTrailingBlock = withTrailingBlock;
//# sourceMappingURL=index.js.map
{
"name": "@udecode/plate-trailing-block",
"version": "7.0.2",
"version": "8.0.0",
"description": "Trailing-block plugin 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