Socket
Socket
Sign inDemoInstall

@udecode/plate-core

Package Overview
Dependencies
Maintainers
2
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/plate-core - npm Package Compare versions

Comparing version 7.0.2 to 8.0.0

dist/common/hoc/createNodeHOC.d.ts

472

CHANGELOG.md
# @udecode/plate-core
## 8.0.0
### Major Changes
- [#1234](https://github.com/udecode/plate/pull/1234) by [@zbeyens](https://github.com/zbeyens) – Breaking changes:
### `Plate`
- removed `components` prop:
```tsx
// Before
<Plate plugins={plugins} components={components} />;
// After
// option 1: use the plugin factory
let plugins = [
createParagraphPlugin({
component: ParagraphElement,
}),
];
// option 2: use createPlugins
plugins = createPlugins(plugins, {
components: {
[ELEMENT_PARAGRAPH]: ParagraphElement,
},
});
<Plate plugins={plugins} />;
```
- removed `options` prop:
```tsx
// Before
<Plate plugins={plugins} options={options} />;
// After
// option 1: use the plugin factory
let plugins = [
createParagraphPlugin({
type: 'paragraph',
}),
];
// option 2: use createPlugins
plugins = createPlugins(plugins, {
overrideByKey: {
[ELEMENT_PARAGRAPH]: {
type: 'paragraph',
},
},
});
<Plate plugins={plugins} />;
```
### `PlatePlugin`
- `key`
- replacing `pluginKey`
- is now required: each plugin needs a key to be retrieved by key.
- all handlers have `plugin` as a second parameter:
```tsx
// Before
export type X<T = {}> = (editor: PlateEditor<T>) => Y;
// After
export type X<T = {}, P = {}> = (
editor: PlateEditor<T>,
plugin: WithPlatePlugin<T, P>
) => Y;
```
- `serialize` no longer has `element` and `leaf` properties:
```ts
type SerializeHtml = RenderFunction<
PlateRenderElementProps | PlateRenderLeafProps
>;
```
Renamed:
- `injectParentComponent` to `inject.aboveComponent`
- `injectChildComponent` to `inject.belowComponent`
- `overrideProps` to `inject.props`
- `transformClassName`, `transformNodeValue`, `transformStyle` first parameter is no longer `editor` as it's provided by `then` if needed.
- the previously `getOverrideProps` is now the core behavior if `inject.props` is defined.
- `serialize` to `serializeHtml`
- `deserialize` to `deserializeHtml`
- can be an array
- the old deserializer options are merged to `deserializeHtml`
```tsx
type DeserializeHtml = {
/**
* List of HTML attribute names to store their values in `node.attributes`.
*/
attributeNames?: string[];
/**
* Deserialize an element.
* Use this instead of plugin.isElement if you don't want the plugin to renderElement.
* @default plugin.isElement
*/
isElement?: boolean;
/**
* Deserialize a leaf.
* Use this instead of plugin.isLeaf if you don't want the plugin to renderLeaf.
* @default plugin.isLeaf
*/
isLeaf?: boolean;
/**
* Deserialize html element to slate node.
*/
getNode?: (element: HTMLElement) => AnyObject | undefined;
query?: (element: HTMLElement) => boolean;
/**
* Deserialize an element:
* - if this option (string) is in the element attribute names.
* - if this option (object) values match the element attributes.
*/
validAttribute?: string | { [key: string]: string | string[] };
/**
* Valid element `className`.
*/
validClassName?: string;
/**
* Valid element `nodeName`.
* Set '*' to allow any node name.
*/
validNodeName?: string | string[];
/**
* Valid element style values.
* Can be a list of string (only one match is needed).
*/
validStyle?: Partial<
Record<keyof CSSStyleDeclaration, string | string[] | undefined>
>;
/**
* Whether or not to include deserialized children on this node
*/
withoutChildren?: boolean;
};
```
- handlers starting by `on...` are moved to `handlers` property.
```ts
// Before
onDrop: handler;
// After
handlers: {
onDrop: handler;
}
```
Removed:
- `renderElement` is favor of:
- `isElement` is a boolean that enables element rendering.
- the previously `getRenderElement` is now the core behavior.
- `renderLeaf` is favor of:
- `isLeaf` is a boolean that enables leaf rendering.
- the previously `getRenderLeaf` is now the core behavior.
- `inlineTypes` and `voidTypes` for:
- `isInline` is a boolean that enables inline rendering.
- `isVoid` is a boolean that enables void rendering.
### General
- the following plugins are now part of the core plugins, so you need to remove these from your `plugins` prop:
```ts
const corePlugins = [
createReactPlugin(),
createHistoryPlugin(),
createEventEditorPlugin(),
createInlineVoidPlugin(),
createInsertDataPlugin(),
createDeserializeAstPlugin(),
createDeserializeHtmlPlugin(),
];
```
- `plugins` is not a parameter anymore as it can be retrieved in `editor.plugins`
- `withInlineVoid` is now using plugins `isInline` and `isVoid` plugin properties.
Renamed:
- `getPlatePluginType` to `getPluginType`
- `getEditorOptions` to `getPlugins`
- `getPlatePluginOptions` to `getPlugin`
- `pipeOverrideProps` to `pipeInjectProps`
- `getOverrideProps` to `pluginInjectProps`
- `serializeHTMLFromNodes` to `serializeHtml`
- `getLeaf` to `leafToHtml`
- `getNode` to `elementToHtml`
- `xDeserializerId` to `KEY_DESERIALIZE_X`
- `deserializeHTMLToText` to `htmlTextNodeToString`
- `deserializeHTMLToMarks` to `htmlElementToLeaf` and `pipeDeserializeHtmlLeaf`
- `deserializeHTMLToElement` to `htmlElementToElement` and `pipeDeserializeHtmlElement`
- `deserializeHTMLToFragment` to `htmlBodyToFragment`
- `deserializeHTMLToDocumentFragment` to `deserializeHtml`
- `deserializeHTMLToBreak` to `htmlBrToNewLine`
- `deserializeHTMLNode` to `deserializeHtmlNode`
- `deserializeHTMLElement` to `deserializeHtmlElement`
Removed:
- `usePlateKeys`, `getPlateKeys`
- `usePlateOptions` for `getPlugin`
- `getPlateSelection` for `getPlateEditorRef().selection`
- `flatMapByKey`
- `getEditableRenderElement` and `getRenderElement` for `pipeRenderElement` and `pluginRenderElement`
- `getEditableRenderLeaf` and `getRenderLeaf` for `pipeRenderLeaf` and `pluginRenderLeaf`
- `getInlineTypes`
- `getVoidTypes`
- `getPlatePluginTypes`
- `getPlatePluginWithOverrides`
- `mapPlatePluginKeysToOptions`
- `withDeserializeX` for `PlatePlugin.editor.insertData`
Changed types:
- `PlateEditor`:
- removed `options` for `pluginsByKey`
- `WithOverride` is not returning an extended editor anymore (input and output editors are assumed to be the same types for simplicity).
- `PlateState`
- renamed `keyChange` to `keyEditor`
- removed `plugins` for `editor.plugins`
- removed `pluginKeys`
- removed `selection` for `editor.selection`
- actions:
- removed `setSelection`, `setPlugins`, `setPluginKeys`
- removed `incrementKeyChange` for
Renamed types:
- `XHTMLY` to `XHtmlY`
- `Deserialize` to `DeseralizeHtml`
Removed types:
- `PlatePluginOptions`:
- `type` to `PlatePlugin.type`
- `component` to `PlatePlugin.component`
- `deserialize` to `PlatePlugin.deserializeHtml`
- `getNodeProps` to `PlatePlugin.props.nodeProps`
- `hotkey` to `HotkeyPlugin`
- `clear` to `ToggleMarkPlugin`
- `defaultType` is hardcoded to `p.type`
- `OverrideProps` for `PlatePlugin.inject.props`
- `Serialize` for `PlatePlugin.serializeHtml`
- `NodeProps` for `AnyObject`
- `OnKeyDownElementOptions` for `HotkeyPlugin`
- `OnKeyDownMarkOptions` for `ToggleMarkPlugin`
- `WithInlineVoidOptions`
- `GetNodeProps` for `PlatePluginProps`
- `DeserializeOptions`, `GetLeafDeserializerOptions`, `GetElementDeserializerOptions`, `GetNodeDeserializerOptions`, `GetNodeDeserializerRule`, `DeserializeNode` for `PlatePlugin.deserializeHtml`
- `PlateOptions`
- `RenderNodeOptions`
- `DeserializedHTMLElement`
### Minor Changes
- [#1234](https://github.com/udecode/plate/pull/1234) by [@zbeyens](https://github.com/zbeyens) – `PlatePlugin` extended:
- These properties are used by `withInsertData` plugin.
```tsx
interface PlatePlugin {
editor?: Nullable<{
insertData?: {
/**
* Format to get data. Example data types are text/plain and text/uri-list.
*/
format?: string;
/**
* Query to skip this plugin.
*/
query?: (options: PlatePluginInsertDataOptions) => boolean;
/**
* Deserialize data to fragment
*/
getFragment?: (
options: PlatePluginInsertDataOptions
) => TDescendant[] | undefined;
// injected
/**
* Function called on `editor.insertData` just before `editor.insertFragment`.
* Default: if the block above the selection is empty and the first fragment node type is not inline,
* set the selected node type to the first fragment node type.
* @return if true, the next handlers will be skipped.
*/
preInsert?: (
fragment: TDescendant[],
options: PlatePluginInsertDataOptions
) => HandlerReturnType;
/**
* Transform the inserted data.
*/
transformData?: (
data: string,
options: { dataTransfer: DataTransfer }
) => string;
/**
* Transform the fragment to insert.
*/
transformFragment?: (
fragment: TDescendant[],
options: PlatePluginInsertDataOptions
) => TDescendant[];
};
}>;
}
```
- `inject.pluginsByKey`:
```tsx
interface PlatePlugin {
inject?: {
/**
* Any plugin can use this property to inject code into a stack.
* For example, if multiple plugins have defined
* `inject.editor.insertData.transformData` for `key=KEY_DESERIALIZE_HTML`,
* `insertData` plugin will call all of these `transformData` for `KEY_DESERIALIZE_HTML` plugin.
* Differs from `overrideByKey` as this is not overriding any plugin.
*/
pluginsByKey?: Record<PluginKey, Partial<PlatePlugin<T>>>;
};
}
```
- `options`: any plugin can use the second generic type to type this property. It means that each plugin can be extended using this property.
- `type` is now optional
- `component`: no longer need of `options` to customize the component.
- `overrideByKey`: a plugin can override other plugins by key (deep merge).
- `plugins`:
- Can be used to pack multiple plugins, like the heading plugin.
- Plate eventually flats all the plugins into `editor.plugins`.
- nesting support (recursive)
- `props`: Override node `component` props. Props object or function with props parameters returning the new props. Previously done by `overrideProps` and `getNodeProps` options.
- `then`: a function that is called after the plugin is loaded.
- this is very powerful as it allows you to have plugin properties derived from the editor and/or the loaded plugin.
- nesting support (recursive)
```ts
interface PlatePlugin {
/**
* Recursive plugin merging.
* Can be used to derive plugin properties from `editor`, `plugin`.
* The returned value will be deeply merged to the plugin.
*/
then?: (
editor: PlateEditor<T>,
plugin: WithPlatePlugin<T, P>
) => Partial<PlatePlugin<T, P>>;
}
```
New plugins:
- `createEventEditorPlugin` (core)
- `createInsertDataPlugin`
- `withInsertData`
- all plugins using `editor.insertData` property will be used here
- it first gets the data with `format`
- then it pipes `query`
- then it pipes `transformData`
- then it calls `getFragment`
- then it pipes `transformFragment`
- then it pipes `insertFragment`
New utils:
- `@udecode/plate-common` has been merged into this package as both packages were dependencies of the exact same packages.
- `@udecode/plate-html-serializer` has been merged into this package.
- `@udecode/plate-ast-serializer` has been merged into this package.
- `@udecode/plate-serializer` has been merged into this package.
- `createPlateEditor`: Create a plate editor with:
- `createEditor` or custom `editor`
- `withPlate`
- custom `components`
- `createPluginFactory`: Create plugin factory with a default plugin.
- The plugin factory:
- param 1 `override` can be used to (deeply) override the default plugin.
- param 2 `overrideByKey` can be used to (deeply) override a nested plugin (in plugin.plugins) by key.
- `createPlugins`: Creates a new array of plugins by overriding the plugins in the original array.
- Components can be overridden by key using `components` in the second param.
- Any other properties can be overridden by key using `overrideByKey` in the second param.
- `findHtmlParentElement`
- `flattenDeepPlugins`: Recursively merge `plugin.plugins` into `editor.plugins` and `editor.pluginsByKey`
- `mergeDeepPlugins`: Recursively merge nested plugins into the root plugins.
- `getInjectedPlugins`:
- Get all plugins having a defined `inject.pluginsByKey[plugin.key]`.
- It includes `plugin` itself.
- `getPluginInjectProps`
- `getPluginOptions`
- `getPluginsByKey`
- `mockPlugin`
- `overridePluginsByKey`: Recursive deep merge of each plugin from `overrideByKey` into plugin with same key (`plugin` > `plugin.plugins`).
- `pipeInsertDataQuery`
- `pipeInsertFragment`
- `pipeTransformData`
- `pipeTransformFragment`
- `setDefaultPlugin`
- `setPlatePlugins`: Flatten deep plugins then set editor.plugins and editor.pluginsByKey
- `deserializeHtmlNodeChildren`
- `isHtmlComment`
- `isHtmlElement`
- `isHtmlText`
- `pluginDeserializeHtml`
New selectors:
- `usePlateKey`
New types:
- `HotkeyPlugin` – `hotkey`
- `ToggleMarkPlugin` – `hotkey`, `mark`
- `OverrideByKey`
- `WithPlatePlugin`:
- `PlatePlugin` with required `type`, `options`, `inject` and `editor`.
- `Plate` will create default values if not defined.
Extended types:
- `PlateEditor`:
- `plugins`: list of the editor plugins
- `pluginsByKey`: map of the editor plugins
- `PlateState`:
- `keyPlugins`: A key that is incremented on each `editor.plugins` change.
- `keySelection`: A key that is incremented on each `editor.selection` change.
- `WithPlateOptions`:
- `disableCorePlugins`
- disable core plugins if you'd prefer to have more control over the plugins order.
## 7.0.2

@@ -60,7 +518,7 @@

- `PlatePlugin`, `PlatePluginEditor` new fields:
- `PlatePlugin`, `PlatePluginEditor` new properties:
- `injectChildComponent`: Inject child component around any node children.
- `injectParentComponent`: Inject parent component around any node `component`.
- `overrideProps` supports arrays.
- `SPRenderNodeProps` new fields:
- `SPRenderNodeProps` new properties:
- `editor: PlateEditor`

@@ -120,3 +578,3 @@ - `plugins: PlatePlugin`

- `PlatePlugin`
- new field: `overrideProps`
- new property: `overrideProps`
- Overrides rendered node props (shallow merge).

@@ -264,4 +722,4 @@ - This enables controlling the props of any node component (use cases: indent, align,...).

- `useEditableProps` (used by `SlatePlugins`):
- new fields returned: all handler props from the plugins (if defined)
- new core plugins with the following fields:
- new properties returned: all handler props from the plugins (if defined)
- new core plugins with the following properties:
- `onFocus: setEventEditorId('focus', id)`

@@ -278,4 +736,4 @@ - `onBlur: setEventEditorId('blur', id)`

- `SlatePluginsState` (store interface):
- a new field `keyChange` incremented by `SlatePlugins` on `useSlate` update.
- a new field `selection = editor.selection` updated on `useSlate` update.
- a new property `keyChange` incremented by `SlatePlugins` on `useSlate` update.
- a new property `selection = editor.selection` updated on `useSlate` update.
- `pipeHandler`: a new function. Generic pipe for handlers.

@@ -282,0 +740,0 @@

2

dist/components/DefaultLeaf.d.ts
/// <reference types="react" />
import { PlateRenderLeafProps } from '../types/PlateRenderLeafProps';
export declare const DefaultLeaf: ({ attributes, children, text, leaf, editor, plugins, nodeProps, ...props }: PlateRenderLeafProps) => JSX.Element;
export declare const DefaultLeaf: ({ attributes, children, text, leaf, editor, nodeProps, ...props }: PlateRenderLeafProps) => JSX.Element;
//# sourceMappingURL=DefaultLeaf.d.ts.map

@@ -19,3 +19,3 @@ import React from 'react';

}
export declare const Plate: <T>({ children, renderEditable, ...options }: PlateProps<T>) => JSX.Element | null;
export declare const Plate: <T extends {} = {}>({ children, renderEditable, ...options }: PlateProps<T>) => JSX.Element | null;
//# sourceMappingURL=Plate.d.ts.map

@@ -6,3 +6,3 @@ import { UsePlateOptions } from '../../types/UsePlateOptions';

*/
export declare const usePlate: <T = {}>({ id, components, editor, initialValue, value, options, plugins, onChange, editableProps, normalizeInitialValue, }: UsePlateOptions<T>) => {
export declare const usePlate: <T = {}>({ id, editor, initialValue, value, plugins, onChange, editableProps, normalizeInitialValue, }: UsePlateOptions<T>) => {
slateProps: Omit<import("../..").SlateProps, "children">;

@@ -9,0 +9,0 @@ editableProps: import("slate-react/dist/components/editable").EditableProps;

@@ -6,3 +6,3 @@ import { UsePlateEffectsOptions } from '../../types/UsePlateEffectsOptions';

*/
export declare const usePlateEffects: <T = {}>({ id, value, editor, enabled, components, options, initialValue, normalizeInitialValue, plugins, }: UsePlateEffectsOptions<T>) => void;
export declare const usePlateEffects: <T = {}>({ id, value, editor: editorProp, enabled: enabledProp, initialValue, normalizeInitialValue, plugins, disableCorePlugins, }: UsePlateEffectsOptions<T>) => void;
//# sourceMappingURL=usePlateEffects.d.ts.map

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

import { SlateProps } from '../../types/SlateProps';
import { SlateProps } from '../../types/slate/SlateProps';
import { UseSlatePropsOptions } from '../../types/UseSlatePropsOptions';

@@ -3,0 +3,0 @@ /**

/**
* @file Automatically generated by barrelsby.
*/
export * from './common/index';
export * from './components/index';

@@ -5,0 +6,0 @@ export * from './hooks/index';

@@ -1,10 +0,5 @@

import { WithOverride } from '../types/PlatePlugin/WithOverride';
/**
* {@link withHistory} that can be called multiple times without losing its history.
* @see {@link withHistory}
*/
export declare const withHistoryPersist: WithOverride;
/**
* @see {@link withHistoryPersist}
*/
export declare const createHistoryPlugin: () => import("..").PlatePlugin<{}>;
export declare const createHistoryPlugin: <T = {}>(override?: Partial<import("..").PlatePlugin<T, {}>> | undefined, overrideByKey?: import("..").OverrideByKey<T>) => import("..").PlatePlugin<T, {}>;
//# sourceMappingURL=createHistoryPlugin.d.ts.map

@@ -1,8 +0,3 @@

import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
import { WithOverride } from '../types/PlatePlugin/WithOverride';
export interface WithInlineVoidOptions {
plugins?: PlatePlugin[];
inlineTypes?: string[];
voidTypes?: string[];
}
import { WithOverride } from '../types/plugins/WithOverride';
export declare const KEY_INLINE_VOID = "inline-void";
/**

@@ -12,7 +7,7 @@ * Merge and register all the inline types and void types from the plugins and options,

*/
export declare const withInlineVoid: ({ plugins, inlineTypes, voidTypes, }: WithInlineVoidOptions) => WithOverride;
export declare const withInlineVoid: WithOverride;
/**
* @see {@link withInlineVoid}
*/
export declare const createInlineVoidPlugin: (options_0: WithInlineVoidOptions) => PlatePlugin<{}>;
export declare const createInlineVoidPlugin: <T = {}>(override?: Partial<import("..").PlatePlugin<T, {}>> | undefined, overrideByKey?: import("..").OverrideByKey<T>) => import("..").PlatePlugin<T, {}>;
//# sourceMappingURL=createInlineVoidPlugin.d.ts.map
/**
* @see {@link withReact}
*/
export declare const createReactPlugin: () => import("..").PlatePlugin<{}>;
export declare const createReactPlugin: <T = {}>(override?: Partial<import("..").PlatePlugin<T, {}>> | undefined, overrideByKey?: import("..").OverrideByKey<T>) => import("..").PlatePlugin<T, {}>;
//# sourceMappingURL=createReactPlugin.d.ts.map
/**
* @file Automatically generated by barrelsby.
*/
export * from './createDeserializeAstPlugin';
export * from './createEventEditorPlugin';
export * from './createHistoryPlugin';
export * from './createInlineVoidPlugin';
export * from './createInsertDataPlugin';
export * from './createReactPlugin';
export * from './withPlate';
export * from './html-deserializer/index';
export * from './html-serializer/index';
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,4 @@

import { PlateActions } from '../../types/PlateStore';
import { PlateActions, PlateChangeKey } from '../../types/PlateStore';
export declare const usePlateActions: <T = {}>(storeId?: string | null | undefined) => PlateActions<T>;
export declare const incrementKey: (key: PlateChangeKey, id?: string | null) => void;
//# sourceMappingURL=plate.actions.d.ts.map

@@ -9,4 +9,3 @@ /**

export * from './usePlateEnabled';
export * from './usePlateKeys';
export * from './usePlateOptions';
export * from './usePlateKey';
export * from './usePlatePlugins';

@@ -13,0 +12,0 @@ export * from './usePlateSelection';

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

export declare const getPlatePlugins: <T = {}>(id?: string | null | undefined) => import("../../..").PlatePlugin<T>[] | undefined;
export declare const usePlatePlugins: (id?: string | null | undefined) => import("../../..").PlatePlugin<{}>[] | undefined;
export declare const getPlatePlugins: <T = {}>(id?: string | null | undefined) => import("../../..").WithPlatePlugin<T, {}>[] | undefined;
export declare const usePlatePlugins: <T = {}>(id?: string | null | undefined) => import("../../..").WithPlatePlugin<T, {}>[] | undefined;
//# sourceMappingURL=usePlatePlugins.d.ts.map

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

export declare const getPlateSelection: <T = {}>(id?: string | null | undefined) => import("slate").BaseSelection | undefined;
/**

@@ -3,0 +2,0 @@ * Get the editor selection which is updated on editor change.

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

export * from './EventEditorStore';
export * from './OverrideByKey';
export * from './PlateEditor';

@@ -11,11 +12,4 @@ export * from './PlateRenderElementProps';

export * from './PlateStore';
export * from './SlateProps';
export * from './TAncestor';
export * from './TDescendant';
export * from './TEditor';
export * from './TElement';
export * from './TNode';
export * from './TRenderElementProps';
export * from './TRenderLeafProps';
export * from './TText';
export * from './RenderElement';
export * from './RenderLeaf';
export * from './UseEditablePropsOptions';

@@ -25,5 +19,5 @@ export * from './UsePlateEffectsOptions';

export * from './UseSlatePropsOptions';
export * from './PlatePlugin/index';
export * from './PlatePluginOptions/index';
export * from './plugins/index';
export * from './slate/index';
export * from './utility/index';
//# sourceMappingURL=index.d.ts.map
import { HistoryEditor } from 'slate-history/dist/history-editor';
import { ReactEditor } from 'slate-react';
import { PlatePluginOptions, PluginKey } from './PlatePluginOptions/PlateOptions';
import { TEditor } from './TEditor';
export declare type PlateEditor<T = {}> = PEditor & HistoryEditor & ReactEditor & T;
export interface PEditor extends TEditor {
import { WithPlatePlugin } from './plugins/PlatePlugin';
import { PluginKey } from './plugins/PlatePluginKey';
import { TEditor } from './slate/TEditor';
export declare type PlateEditor<T = {}> = PEditor<T> & HistoryEditor & ReactEditor & T;
export interface PEditor<T = {}> extends TEditor {
key: any;
id: string;
options: Record<PluginKey, Partial<PlatePluginOptions>>;
plugins: WithPlatePlugin<T>[];
pluginsByKey: Record<PluginKey, WithPlatePlugin<T>>;
}
//# sourceMappingURL=PlateEditor.d.ts.map

@@ -0,4 +1,4 @@

import { TRenderElementProps } from './slate/TRenderElementProps';
import { AnyObject } from './utility/AnyObject';
import { PlateRenderNodeProps } from './PlateRenderNodeProps';
import { TRenderElementProps } from './TRenderElementProps';
/**

@@ -5,0 +5,0 @@ * Element props passed by Plate

@@ -0,4 +1,4 @@

import { TRenderLeafProps } from './slate/TRenderLeafProps';
import { AnyObject } from './utility/AnyObject';
import { PlateRenderNodeProps } from './PlateRenderNodeProps';
import { TRenderLeafProps } from './TRenderLeafProps';
/**

@@ -5,0 +5,0 @@ * Leaf props passed by Plate

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

import { PlatePlugin } from './PlatePlugin/PlatePlugin';
import { NodeProps } from './PlatePluginOptions/GetNodeProps';
import { AnyObject } from './utility/AnyObject';

@@ -9,10 +7,9 @@ import { PlateEditor } from './PlateEditor';

export interface PlateRenderNodeProps extends AnyObject {
className?: string;
editor: PlateEditor;
plugins: PlatePlugin[];
className?: string;
/**
* @see {@link NodeProps}
*/
nodeProps?: NodeProps;
nodeProps?: AnyObject;
}
//# sourceMappingURL=PlateRenderNodeProps.d.ts.map

@@ -1,5 +0,3 @@

import { Editor } from 'slate';
import { PlatePlugin } from './PlatePlugin/PlatePlugin';
import { TDescendant } from './slate/TDescendant';
import { PlateEditor } from './PlateEditor';
import { TDescendant } from './TDescendant';
/**

@@ -12,2 +10,3 @@ * A unique id used to store the editor state by id.

export declare type EditorId = string | null | undefined;
export declare type PlateChangeKey = 'keyEditor' | 'keyPlugins' | 'keySelection';
export declare type PlateState<T = {}> = {

@@ -22,4 +21,12 @@ /**

*/
keyChange?: number;
keyEditor?: number;
/**
* A key that is incremented on each editor.plugins change.
*/
keyPlugins?: number;
/**
* A key that is incremented on each editor.selection change.
*/
keySelection?: number;
/**
* If true, plate will create the editor with `withPlate`.

@@ -31,12 +38,2 @@ * If false, plate will remove the editor from the store.

/**
* Plate plugins.
* @default [createReactPlugin(), createHistoryPlugin()]
*/
plugins: PlatePlugin<T>[];
/**
* Element keys used by the plugins
*/
pluginKeys: string[];
selection: Editor['selection'];
/**
* Editor value.

@@ -65,9 +62,5 @@ * @default [{ children: [{ text: '' }]}]

setEditor: (value: PlateState<T>['editor'], id?: string) => void;
setSelection: (value: PlateState<T>['selection'], id?: string) => void;
incrementKeyChange: (id?: string) => void;
setEnabled: (value: PlateState<T>['enabled'], id?: string) => void;
setPlugins: (value: PlateState<T>['plugins'], id?: string) => void;
setPluginKeys: (value: PlateState<T>['pluginKeys'], id?: string) => void;
setValue: (value: PlateState<T>['value'], id?: string) => void;
};
//# sourceMappingURL=PlateStore.d.ts.map

@@ -1,8 +0,7 @@

import { PlateOptions, PlatePluginComponent } from './PlatePluginOptions/PlateOptions';
import { EditorId, PlateState } from './PlateStore';
import { WithPlateOptions } from '../plugins/withPlate';
import { PlateState } from './PlateStore';
/**
* `usePlateEffects` options
*/
export interface UsePlateEffectsOptions<T = {}> extends Partial<Pick<PlateState<T>, 'editor' | 'value' | 'enabled' | 'plugins'>> {
id?: EditorId;
export interface UsePlateEffectsOptions<T = {}> extends WithPlateOptions<T>, Partial<Pick<PlateState<T>, 'editor' | 'value' | 'enabled'>> {
/**

@@ -13,10 +12,3 @@ * Initial value of the editor.

initialValue?: PlateState['value'];
options?: PlateOptions;
/**
* Components stored by plugin key.
* These will be merged into `options`.
* @see {@link EditorId}
*/
components?: Record<string, PlatePluginComponent>;
/**
* When `true`, it will normalize the initial value passed to the `editor` once it gets created.

@@ -23,0 +15,0 @@ * This is useful when adding normalization rules on already existing content.

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

import { TNode } from './TNode';
import { TNode } from './slate/TNode';
import { UsePlateEffectsOptions } from './UsePlateEffectsOptions';

@@ -3,0 +3,0 @@ /**

@@ -5,5 +5,9 @@ /**

export * from './AnyObject';
export * from './DeepPartial';
export * from './FunctionProperties';
export * from './NoInfer';
export * from './Nullable';
export * from './RenderFunction';
export * from './WithOptional';
export * from './types';
//# sourceMappingURL=index.d.ts.map

@@ -5,7 +5,6 @@ /// <reference types="react" />

*/
export interface RenderFunction<P = {
[key: string]: any;
}> {
import { AnyObject } from './AnyObject';
export interface RenderFunction<P = AnyObject> {
(props: P, defaultRender?: (props?: P) => JSX.Element | null): JSX.Element | null;
}
//# sourceMappingURL=RenderFunction.d.ts.map

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

import { DOMHandlers } from '../types/PlatePlugin/DOMHandlers';
import { DOMHandlers } from '../types/plugins/DOMHandlers';
export declare const DOM_HANDLERS: (keyof DOMHandlers)[];
//# sourceMappingURL=dom-attributes.d.ts.map

@@ -1,13 +0,15 @@

import { RenderNodeOptions } from '../types/PlatePluginOptions/RenderNodeOptions';
import { PlateRenderNodeProps } from '../types/PlateRenderNodeProps';
import { WithPlatePlugin } from '../types/plugins/PlatePlugin';
import { AnyObject } from '../types/utility/AnyObject';
/**
* Get node props: `nodeProps`, `className`, `overrideProps`
* Override node props with plugin props.
* `props.element.attributes` are passed as `nodeProps`.
* Extend the class name with the node type.
*/
export declare const getRenderNodeProps: <T extends PlateRenderNodeProps>({ attributes, overrideProps, type, getNodeProps, props: _props, }: Omit<RenderNodeOptions, "component"> & {
props: T;
attributes?: any;
export declare const getRenderNodeProps: <T extends PlateRenderNodeProps>({ attributes, nodeProps, props, type, }: Pick<WithPlatePlugin<{}, {}>, "type" | "props"> & {
attributes?: AnyObject | undefined;
nodeProps: T;
}) => T & {
className: string;
nodeProps: any;
};
//# sourceMappingURL=getRenderNodeProps.d.ts.map
/**
* @file Automatically generated by barrelsby.
*/
export * from './applyDeepToNodes';
export * from './createPlateEditor';
export * from './createPluginFactory';
export * from './createPlugins';
export * from './dom-attributes';
export * from './flatMapByKey';
export * from './getEditableRenderElement';
export * from './getEditableRenderLeaf';
export * from './getEditorOptions';
export * from './getInlineTypes';
export * from './getPlatePluginOptions';
export * from './getPlatePluginType';
export * from './getPlatePluginTypes';
export * from './getPlatePluginWithOverrides';
export * from './getRenderElement';
export * from './getRenderLeaf';
export * from './flattenDeepPlugins';
export * from './getInjectedPlugins';
export * from './getPlugin';
export * from './getPluginInjectProps';
export * from './getPluginOptions';
export * from './getPluginType';
export * from './getPlugins';
export * from './getPluginsByKey';
export * from './getRenderNodeProps';
export * from './getSlateClass';
export * from './getVoidTypes';
export * from './mapPlatePluginKeysToOptions';
export * from './mergeDeepPlugins';
export * from './mergeDeepToNodes';
export * from './mockPlugin';
export * from './overridePluginsByKey';
export * from './pipe';
export * from './pipeDecorate';
export * from './pipeHandler';
export * from './pipeInjectProps';
export * from './pipeInsertDataQuery';
export * from './pipeInsertFragment';
export * from './pipeOnChange';
export * from './pipeOverrideProps';
export * from './pipeRenderElement';
export * from './pipeRenderLeaf';
export * from './withPlate';
export * from './pipeTransformData';
export * from './pipeTransformFragment';
export * from './pluginInjectProps';
export * from './pluginRenderElement';
export * from './pluginRenderLeaf';
export * from './setDefaultPlugin';
export * from './setPlatePlugins';
//# sourceMappingURL=index.d.ts.map
import { EditableProps } from 'slate-react/dist/components/editable';
import { PlateEditor } from '../types/PlateEditor';
import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
/**

@@ -8,3 +7,3 @@ * @see {@link Decorate}.

*/
export declare const pipeDecorate: (editor: PlateEditor, plugins?: PlatePlugin[]) => EditableProps['decorate'];
export declare const pipeDecorate: (editor: PlateEditor) => EditableProps['decorate'];
//# sourceMappingURL=pipeDecorate.d.ts.map
import { SyntheticEvent } from 'react';
import { EditableProps } from 'slate-react/dist/components/editable';
import { PlateEditor } from '../types/PlateEditor';
import { DOMHandlers } from '../types/PlatePlugin/DOMHandlers';
import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
import { DOMHandlers } from '../types/plugins/DOMHandlers';
/**

@@ -17,7 +16,6 @@ * Check if an event is overrided by a handler.

*/
export declare const pipeHandler: <K extends keyof DOMHandlers<{}>>(editor: PlateEditor, { editableProps, handlerKey, plugins, }: {
export declare const pipeHandler: <K extends keyof DOMHandlers<{}, {}>>(editor: PlateEditor, { editableProps, handlerKey, }: {
editableProps?: EditableProps | undefined;
handlerKey: K;
plugins?: PlatePlugin<{}>[] | undefined;
}) => ((event: any) => void) | undefined;
//# sourceMappingURL=pipeHandler.d.ts.map
import { PlateEditor } from '../types/PlateEditor';
import { OnChange } from '../types/PlatePlugin/OnChange';
import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
export declare const pipeOnChange: (editor: PlateEditor, plugins?: PlatePlugin[]) => ReturnType<OnChange>;
import { OnChange } from '../types/plugins/OnChange';
export declare const pipeOnChange: (editor: PlateEditor) => ReturnType<OnChange>;
//# sourceMappingURL=pipeOnChange.d.ts.map
import { EditableProps } from 'slate-react/dist/components/editable';
import { PlateEditor } from '../types/PlateEditor';
import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
/**
* @see {@link RenderElement}
*/
export declare const pipeRenderElement: (editor: PlateEditor, plugins?: PlatePlugin[]) => EditableProps['renderElement'];
export declare const pipeRenderElement: (editor: PlateEditor, editableProps?: EditableProps | undefined) => EditableProps['renderElement'];
//# sourceMappingURL=pipeRenderElement.d.ts.map
import { EditableProps } from 'slate-react/dist/components/editable';
import { PlateEditor } from '../types/PlateEditor';
import { PlatePlugin } from '../types/PlatePlugin/PlatePlugin';
/**
* @see {@link RenderLeaf}
*/
export declare const pipeRenderLeaf: (editor: PlateEditor, plugins?: PlatePlugin[]) => EditableProps['renderLeaf'];
export declare const pipeRenderLeaf: (editor: PlateEditor, editableProps?: EditableProps | undefined) => EditableProps['renderLeaf'];
//# sourceMappingURL=pipeRenderLeaf.d.ts.map
{
"name": "@udecode/plate-core",
"version": "7.0.2",
"version": "8.0.0",
"description": "The core architecture of Plate – a plugin system for slate",

@@ -5,0 +5,0 @@ "keywords": [

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

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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

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

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

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

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