@udecode/plate-core
Advanced tools
Comparing version 8.3.0 to 9.0.0
# @udecode/plate-core | ||
## 9.0.0 | ||
### Major Changes | ||
- [#1303](https://github.com/udecode/plate/pull/1303) by [@zbeyens](https://github.com/zbeyens) – | ||
- `Plate` | ||
- `editor` prop can now be fully controlled: Plate is not applying `withPlate` on it anymore | ||
- `PlatePlugin.deserializeHtml` | ||
- can't be an array anymore | ||
- moved `validAttribute`, `validClassName`, `validNodeName`, `validStyle` to `deserializeHtml.rules` property | ||
- renamed `plateStore` to `platesStore` | ||
- `platesStore` is now a zustood store | ||
- `eventEditorStore` is now a zustood store | ||
- `getPlateId` now gets the last editor id if not focused or blurred | ||
- used by `usePlateEditorRef` and `usePlateEditorState` | ||
- removed: | ||
- `usePlateEnabled` for `usePlateSelectors(id).enabled()` | ||
- `usePlateValue` for `usePlateSelectors(id).value()` | ||
- `usePlateActions`: | ||
- `resetEditor` for `getPlateActions(id).resetEditor()` | ||
- `clearState` for `platesActions.unset()` | ||
- `setInitialState` for `platesActions.set(id)` | ||
- `setEditor` for `getPlateActions(id).editor(value)` | ||
- `setEnabled` for `getPlateActions(id).enabled(value)` | ||
- `setValue` for `getPlateActions(id).value(value)` | ||
- `getPlateState` | ||
- `usePlateState` | ||
- `usePlateKey` | ||
### Minor Changes | ||
- [#1303](https://github.com/udecode/plate/pull/1303) by [@zbeyens](https://github.com/zbeyens) – | ||
- new packages | ||
- `@udecode/zustood` | ||
- `use-deep-compare` | ||
- `Plate` | ||
- renders a new component: `EditorRefEffect` | ||
- it renders `plugin.useHooks(editor, plugin)` for all `editor.plugins` | ||
- note that it will unmount and remount the hooks on `plugins` change | ||
- `useEditableProps` | ||
- subscribes to the store `editableProps`, `decorate`, `renderLeaf`, `renderElement` | ||
- `decorate`, `renderLeaf`, `renderElement` are now separately memoized | ||
- `useDeepCompareMemo` instead of `useMemo` for performance | ||
- `useSlateProps` | ||
- subscribes to the store `onChange`, `value` | ||
- `usePlateEffects` | ||
- update the plate store on props change: | ||
- `editableProps` | ||
- `onChange` | ||
- `value` | ||
- `enabled` | ||
- `plugins` | ||
- `decorate` | ||
- `renderElement` | ||
- `renderLeaf` | ||
- `PlatePlugin` | ||
- `useHooks`: new property to use hooks once the editor is initialized. | ||
- `deserializeHtml` | ||
- `getNode` has a new parameter `node` | ||
- `getNode` can be injected by other plugins | ||
- `createPlateStore`: create a plate zustood store | ||
- actions: `resetEditor`, `incrementKey` | ||
- new properties: | ||
- `plugins` | ||
- `decorate` | ||
- `renderElement` | ||
- `renderLeaf` | ||
- `editableProps` | ||
- `onChange` | ||
- `platesStore`: | ||
- actions: `set`, `unset` | ||
- selectors: `get` | ||
- `usePlateId`: hook version of `getPlateId` | ||
- `platesActions` | ||
- `getPlateActions` | ||
- `getPlateSelectors` | ||
- `usePlateSelectors` | ||
- `getPlateStore` | ||
- `usePlateStore` | ||
- `eventEditorActions` | ||
- `eventEditorSelectors` | ||
- `useEventEditorSelectors` | ||
- `mapInjectPropsToPlugin`: Map plugin inject props to injected plugin | ||
### Patch Changes | ||
- [#1303](https://github.com/udecode/plate/pull/1303) by [@zbeyens](https://github.com/zbeyens) – | ||
- fix performance issue with hundreds of Plate editors | ||
- fix a bug where `editor.plugins` was reversed | ||
- `Plate` | ||
- `editor.plugins` were missing plugins on `plugins` prop change | ||
- `withInlineVoid`: | ||
- use `plugin.type` instead of `plugin.key` | ||
## 8.3.0 | ||
@@ -4,0 +98,0 @@ |
/// <reference types="react" /> | ||
import { UseEditablePropsOptions } from '../types/UseEditablePropsOptions'; | ||
import { PlateProps } from './Plate'; | ||
/** | ||
* {@link Editable} with plugins support. | ||
*/ | ||
export declare const EditablePlugins: (props: UseEditablePropsOptions) => JSX.Element; | ||
export declare const EditablePlugins: (props: Pick<PlateProps, 'id'>) => JSX.Element; | ||
//# sourceMappingURL=EditablePlugins.d.ts.map |
@@ -6,4 +6,5 @@ /** | ||
export * from './EditablePlugins'; | ||
export * from './EditorRefEffect'; | ||
export * from './EditorStateEffect'; | ||
export * from './Plate'; | ||
//# sourceMappingURL=index.d.ts.map |
import React from 'react'; | ||
import { EditableProps } from 'slate-react/dist/components/editable'; | ||
import { UsePlateEffectsOptions } from '../types/UsePlateEffectsOptions'; | ||
import { UseSlatePropsOptions } from '../types/UseSlatePropsOptions'; | ||
export interface PlateProps<T = {}> extends UsePlateEffectsOptions<T>, UseSlatePropsOptions { | ||
import { PlateStoreState } from '../types/PlateStore'; | ||
export interface PlateProps<T = {}> extends Partial<Omit<PlateStoreState<T>, 'keyEditor' | 'keyPlugins' | 'keySelection'>> { | ||
/** | ||
@@ -11,6 +9,26 @@ * The children rendered inside `Slate` before the `Editable` component. | ||
/** | ||
* The props for the `Editable` component. | ||
* If `true`, disable all the core plugins. | ||
* If an object, disable the core plugin properties that are `true` in the object. | ||
*/ | ||
editableProps?: EditableProps; | ||
disableCorePlugins?: { | ||
deserializeAst?: boolean; | ||
deserializeHtml?: boolean; | ||
eventEditor?: boolean; | ||
inlineVoid?: boolean; | ||
insertData?: boolean; | ||
history?: boolean; | ||
react?: boolean; | ||
} | boolean; | ||
/** | ||
* Initial value of the editor. | ||
* @default [{ children: [{ text: '' }]}] | ||
*/ | ||
initialValue?: PlateStoreState['value']; | ||
/** | ||
* When `true`, it will normalize the initial value passed to the `editor` once it gets created. | ||
* This is useful when adding normalization rules on already existing content. | ||
* @default false | ||
*/ | ||
normalizeInitialValue?: boolean; | ||
/** | ||
* Custom `Editable` node. | ||
@@ -17,0 +35,0 @@ */ |
@@ -7,3 +7,4 @@ /** | ||
export * from './usePlateEffects'; | ||
export * from './usePlateStoreEffects'; | ||
export * from './useSlateProps'; | ||
//# sourceMappingURL=index.d.ts.map |
import { EditableProps } from 'slate-react/dist/components/editable'; | ||
import { UseEditablePropsOptions } from '../../types/UseEditablePropsOptions'; | ||
export declare const useEditableProps: ({ id, editableProps, }: UseEditablePropsOptions) => EditableProps; | ||
import { PlateProps } from '../../components/Plate'; | ||
export declare const useEditableProps: ({ id, }: Pick<PlateProps, 'id'>) => EditableProps; | ||
//# sourceMappingURL=useEditableProps.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { UsePlateOptions } from '../../types/UsePlateOptions'; | ||
import { PlateProps } from '../../components/Plate'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Run `usePlateEffects` and props getter for `Slate` and `Editable` components. | ||
*/ | ||
export declare const usePlate: <T = {}>({ id, editor, initialValue, value, plugins, onChange, editableProps, normalizeInitialValue, }: UsePlateOptions<T>) => { | ||
export declare const usePlate: <T = {}>(options: PlateProps<T>) => { | ||
slateProps: Omit<import("../..").SlateProps, "children">; | ||
@@ -9,0 +9,0 @@ editableProps: import("slate-react/dist/components/editable").EditableProps; |
@@ -1,2 +0,2 @@ | ||
import { UsePlateEffectsOptions } from '../../types/UsePlateEffectsOptions'; | ||
import { PlateProps } from '../../components/Plate'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Effects to update the plate store from the options. | ||
*/ | ||
export declare const usePlateEffects: <T = {}>({ id, value, editor: editorProp, enabled: enabledProp, initialValue, normalizeInitialValue, plugins, disableCorePlugins, }: UsePlateEffectsOptions<T>) => void; | ||
export declare const usePlateEffects: <T = {}>({ id, editor: editorProp, initialValue, normalizeInitialValue, plugins: pluginsProp, disableCorePlugins, editableProps, onChange, value, enabled: enabledProp, }: PlateProps<T>) => void; | ||
//# sourceMappingURL=usePlateEffects.d.ts.map |
@@ -0,7 +1,7 @@ | ||
import { PlateProps } from '../../components/Plate'; | ||
import { SlateProps } from '../../types/slate/SlateProps'; | ||
import { UseSlatePropsOptions } from '../../types/UseSlatePropsOptions'; | ||
/** | ||
* Get Slate props stored in a global store. | ||
*/ | ||
export declare const useSlateProps: ({ id, onChange: _onChange, }?: UseSlatePropsOptions) => Omit<SlateProps, 'children'>; | ||
export declare const useSlateProps: ({ id }?: Pick<PlateProps, 'id'>) => Omit<SlateProps, 'children'>; | ||
//# sourceMappingURL=useSlateProps.d.ts.map |
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
export * from './constants'; | ||
export * from './createDeserializeHtmlPlugin'; | ||
@@ -5,0 +6,0 @@ export * from './types'; |
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
export * from './cleanHtmlBrElements'; | ||
export * from './cleanHtmlCrLf'; | ||
export * from './cleanHtmlEmptyElements'; | ||
export * from './cleanHtmlFontElements'; | ||
export * from './cleanHtmlLinkElements'; | ||
export * from './cleanHtmlTextNodes'; | ||
export * from './copyBlockMarksToSpanChild'; | ||
export * from './deserializeHtml'; | ||
@@ -8,2 +15,4 @@ export * from './deserializeHtmlElement'; | ||
export * from './deserializeHtmlNodeChildren'; | ||
export * from './findHtmlElement'; | ||
export * from './getHtmlComments'; | ||
export * from './htmlBodyToFragment'; | ||
@@ -14,5 +23,8 @@ export * from './htmlBrToNewLine'; | ||
export * from './htmlTextNodeToString'; | ||
export * from './isHtmlBlockElement'; | ||
export * from './isHtmlComment'; | ||
export * from './isHtmlElement'; | ||
export * from './isHtmlFragmentHref'; | ||
export * from './isHtmlText'; | ||
export * from './isOlSymbol'; | ||
export * from './parseHtmlDocument'; | ||
@@ -23,2 +35,12 @@ export * from './parseHtmlElement'; | ||
export * from './pluginDeserializeHtml'; | ||
export * from './postCleanHtml'; | ||
export * from './preCleanHtml'; | ||
export * from './removeHtmlNodesBetweenComments'; | ||
export * from './removeHtmlSurroundings'; | ||
export * from './replaceTagName'; | ||
export * from './traverseHtmlComments'; | ||
export * from './traverseHtmlElements'; | ||
export * from './traverseHtmlNode'; | ||
export * from './traverseHtmlTexts'; | ||
export * from './unwrapHtmlElement'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { PlateEditor } from '../../../types/PlateEditor'; | ||
import { DeserializeHtml } from '../../../types/plugins/DeserializeHtml'; | ||
@@ -8,3 +9,3 @@ import { WithPlatePlugin } from '../../../types/plugins/PlatePlugin'; | ||
*/ | ||
export declare const pluginDeserializeHtml: <T = {}, P = {}>(plugin: WithPlatePlugin<T, P>, { element: el, deserializeLeaf, }: { | ||
export declare const pluginDeserializeHtml: <T = {}, P = {}>(editor: PlateEditor<T>, plugin: WithPlatePlugin<T, P>, { element: el, deserializeLeaf, }: { | ||
element: HTMLElement; | ||
@@ -11,0 +12,0 @@ deserializeLeaf?: boolean | undefined; |
@@ -0,28 +1,5 @@ | ||
import { PlateProps } from '../components/Plate'; | ||
import { PlateEditor } from '../types/PlateEditor'; | ||
import { PlatePlugin } from '../types/plugins/PlatePlugin'; | ||
import { TEditor } from '../types/slate/TEditor'; | ||
export interface WithPlateOptions<T = {}> { | ||
/** | ||
* A unique id used to store the editor state by id. | ||
* Required if rendering multiple `Plate`. Optional otherwise. | ||
* Default is `'main'`. | ||
*/ | ||
id?: string | null; | ||
/** | ||
* Plate plugins. | ||
*/ | ||
plugins?: PlatePlugin<T>[]; | ||
/** | ||
* If `true`, disable all the core plugins. | ||
* If an object, disable the core plugin properties that are `true` in the object. | ||
*/ | ||
disableCorePlugins?: { | ||
deserializeAst?: boolean; | ||
deserializeHtml?: boolean; | ||
eventEditor?: boolean; | ||
inlineVoid?: boolean; | ||
insertData?: boolean; | ||
history?: boolean; | ||
react?: boolean; | ||
} | boolean; | ||
export interface WithPlateOptions<T = {}> extends Pick<PlateProps<T>, 'id' | 'disableCorePlugins' | 'plugins'> { | ||
} | ||
@@ -29,0 +6,0 @@ /** |
@@ -0,10 +1,11 @@ | ||
import { EditorId } from '../../types/PlateStore'; | ||
export declare type EventEditorKey = 'blur' | 'focus' | 'last'; | ||
export declare type EventEditorState = Record<EventEditorKey, EditorId | null>; | ||
/** | ||
* Store where the keys are event names and the values are editor ids. | ||
*/ | ||
export declare const eventEditorStore: import("zustand").StoreApi<Partial<Record<import("../../types/EventEditorStore").EditorEvent, import("../..").EditorId>>>; | ||
/** | ||
* Store where the keys are event names and the values are editor ids. | ||
* @see zustand store | ||
*/ | ||
export declare const useEventEditorStore: import("zustand").UseStore<Partial<Record<import("../../types/EventEditorStore").EditorEvent, import("../..").EditorId>>>; | ||
export declare const eventEditorStore: import("@udecode/zustood").StoreApi<"event-editor", EventEditorState, import("@udecode/zustood").StateActions<EventEditorState>, {}>; | ||
export declare const eventEditorActions: import("@udecode/zustood").StateActions<EventEditorState>; | ||
export declare const eventEditorSelectors: import("@udecode/zustood").StoreApiGet<EventEditorState, {}>; | ||
export declare const useEventEditorSelectors: import("@udecode/zustood").GetRecord<EventEditorState>; | ||
//# sourceMappingURL=event-editor.store.d.ts.map |
@@ -5,4 +5,2 @@ /** | ||
export * from './event-editor.store'; | ||
export * from './actions/index'; | ||
export * from './selectors/index'; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
export * from './zustand.utils'; | ||
export * from './event-editor/index'; | ||
export * from './plate/index'; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
export * from './plate.actions'; | ||
export * from './plate.store'; | ||
export * from './createPlateStore'; | ||
export * from './platesStore'; | ||
export * from './usePlateStore'; | ||
export * from './selectors/index'; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* - Get the last focused editor id if any | ||
* - Else, get the last blurred editor id if any | ||
* - Else, get the first editor id if any | ||
* - Else, get the last editor id if any | ||
* - Else, `null` | ||
*/ | ||
export declare const getPlateId: () => string | null; | ||
export declare const getPlateId: (id?: string | undefined) => string; | ||
export declare const usePlateId: (id?: string | undefined) => string; | ||
//# sourceMappingURL=getPlateId.d.ts.map |
@@ -5,11 +5,6 @@ /** | ||
export * from './getPlateId'; | ||
export * from './getPlateState'; | ||
export * from './usePlateEditorRef'; | ||
export * from './usePlateEditorState'; | ||
export * from './usePlateEnabled'; | ||
export * from './usePlateKey'; | ||
export * from './usePlatePlugins'; | ||
export * from './usePlateSelection'; | ||
export * from './usePlateState'; | ||
export * from './usePlateValue'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,6 +0,7 @@ | ||
export declare const getPlateEditorRef: <T = {}>(id?: string | null | undefined) => import("../../..").PlateEditor<T> | undefined; | ||
import { PlateEditor } from '../../../types/PlateEditor'; | ||
export declare const getPlateEditorRef: <T = {}>(id?: string | undefined) => PlateEditor<T>; | ||
/** | ||
* Get editor ref which is never updated. | ||
*/ | ||
export declare const usePlateEditorRef: <T = {}>(id?: string | null | undefined) => import("../../..").PlateEditor<T> | undefined; | ||
export declare const usePlateEditorRef: <T = {}>(id?: string | undefined) => PlateEditor<T>; | ||
//# sourceMappingURL=usePlateEditorRef.d.ts.map |
/** | ||
* Get editor state which is updated on editor change. | ||
*/ | ||
export declare const usePlateEditorState: <T = {}>(id?: string | null | undefined) => import("../../..").PlateEditor<T> | undefined; | ||
export declare const usePlateEditorState: <T = {}>(id?: string | undefined) => import("../../..").PlateEditor<T>; | ||
//# sourceMappingURL=usePlateEditorState.d.ts.map |
@@ -1,3 +0,3 @@ | ||
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; | ||
export declare const getPlatePlugins: <T = {}>(id?: string | undefined) => import("../../..").WithPlatePlugin<T, {}>[] | undefined; | ||
export declare const usePlatePlugins: <T = {}>(id?: string | undefined) => import("../../..").WithPlatePlugin<T, {}>[] | undefined; | ||
//# sourceMappingURL=usePlatePlugins.d.ts.map |
/** | ||
* Get the editor selection which is updated on editor change. | ||
*/ | ||
export declare const usePlateSelection: (id?: string | null | undefined) => import("slate").BaseSelection | undefined; | ||
export declare const usePlateSelection: (id?: string | undefined) => import("slate").BaseSelection; | ||
//# sourceMappingURL=usePlateSelection.d.ts.map |
/** | ||
* @file Automatically generated by barrelsby. | ||
*/ | ||
export * from './EventEditorStore'; | ||
export * from './OverrideByKey'; | ||
@@ -13,6 +12,2 @@ export * from './PlateEditor'; | ||
export * from './RenderLeaf'; | ||
export * from './UseEditablePropsOptions'; | ||
export * from './UsePlateEffectsOptions'; | ||
export * from './UsePlateOptions'; | ||
export * from './UseSlatePropsOptions'; | ||
export * from './plugins/index'; | ||
@@ -19,0 +14,0 @@ export * from './slate/index'; |
@@ -0,2 +1,8 @@ | ||
import { EditableProps } from 'slate-react/dist/components/editable'; | ||
import { createPlateStore } from '../stores/plate/createPlateStore'; | ||
import { platesStore } from '../stores/plate/platesStore'; | ||
import { PlatePlugin } from './plugins/PlatePlugin'; | ||
import { TDescendant } from './slate/TDescendant'; | ||
import { TNode } from './slate/TNode'; | ||
import { Nullable } from './utility/Nullable'; | ||
import { PlateEditor } from './PlateEditor'; | ||
@@ -11,21 +17,21 @@ /** | ||
export declare type PlateChangeKey = 'keyEditor' | 'keyPlugins' | 'keySelection'; | ||
export declare type PlateState<T = {}> = { | ||
export declare type PlateStoreState<T = {}> = { | ||
/** | ||
* Slate editor reference. | ||
* @default pipe(createEditor(), withPlate({ id, plugins, options, components })) | ||
* A unique id used to store the editor state by id. | ||
* Required if rendering multiple `Plate`. Optional otherwise. | ||
* Default is `'main'`. | ||
*/ | ||
editor?: PlateEditor<T>; | ||
id: string; | ||
plugins: PlatePlugin<T>[]; | ||
} & Required<Nullable<Pick<EditableProps, 'decorate' | 'renderElement' | 'renderLeaf'>>> & Nullable<{ | ||
/** | ||
* A key that is incremented on each editor change. | ||
* The props for the `Editable` component. | ||
*/ | ||
keyEditor?: number; | ||
editableProps: EditableProps; | ||
/** | ||
* A key that is incremented on each editor.plugins change. | ||
* Slate editor reference. | ||
* @default pipe(createEditor(), withPlate({ id, plugins, options, components })) | ||
*/ | ||
keyPlugins?: number; | ||
editor: PlateEditor<T>; | ||
/** | ||
* A key that is incremented on each editor.selection change. | ||
*/ | ||
keySelection?: number; | ||
/** | ||
* If true, plate will create the editor with `withPlate`. | ||
@@ -35,30 +41,28 @@ * If false, plate will remove the editor from the store. | ||
*/ | ||
enabled?: boolean; | ||
enabled: boolean; | ||
/** | ||
* Editor value. | ||
* @default [{ children: [{ text: '' }]}] | ||
* A key that is incremented on each editor change. | ||
*/ | ||
value: TDescendant[]; | ||
}; | ||
/** | ||
* @see {@link EditorId} | ||
*/ | ||
export declare type PlateStates<T = {}> = Record<string, PlateState<T>>; | ||
export declare type PlateActions<T = {}> = { | ||
keyEditor: number; | ||
/** | ||
* Remove state by id. Called by `Plate` on unmount. | ||
* A key that is incremented on each editor.plugins change. | ||
*/ | ||
clearState: (id?: string) => void; | ||
keyPlugins: number; | ||
/** | ||
* Set initial state by id. Called by `Plate` on mount. | ||
* A key that is incremented on each editor.selection change. | ||
*/ | ||
setInitialState: (value?: Partial<PlateState<T>>, id?: string) => void; | ||
keySelection: number; | ||
/** | ||
* Set a new editor with plate. | ||
* Controlled callback called when the editor state changes. | ||
*/ | ||
resetEditor: (id?: string) => void; | ||
setEditor: (value: PlateState<T>['editor'], id?: string) => void; | ||
setEnabled: (value: PlateState<T>['enabled'], id?: string) => void; | ||
setValue: (value: PlateState<T>['value'], id?: string) => void; | ||
}; | ||
onChange: (value: TNode[]) => void; | ||
/** | ||
* Value of the editor. | ||
* @default [{ type: 'p', children: [{ text: '' }]}] | ||
*/ | ||
value: TDescendant[]; | ||
}>; | ||
export declare type PlateStoreApi = ReturnType<typeof createPlateStore>; | ||
export declare type PlatesStoreApi = typeof platesStore; | ||
export declare type PlatesStoreState = Record<string, PlateStoreApi>; | ||
//# sourceMappingURL=PlateStore.d.ts.map |
@@ -22,27 +22,29 @@ import { AnyObject } from '../utility/AnyObject'; | ||
*/ | ||
getNode?: (element: HTMLElement) => AnyObject | undefined; | ||
getNode?: (element: HTMLElement, node: AnyObject) => AnyObject | undefined | void; | ||
query?: (element: HTMLElement) => boolean; | ||
rules?: { | ||
/** | ||
* 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>>; | ||
}[]; | ||
/** | ||
* 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 | ||
@@ -49,0 +51,0 @@ */ |
@@ -98,3 +98,3 @@ import { PlateEditor } from '../PlateEditor'; | ||
*/ | ||
deserializeHtml?: Nullable<DeserializeHtml> | Nullable<DeserializeHtml>[]; | ||
deserializeHtml?: Nullable<DeserializeHtml>; | ||
/** | ||
@@ -124,4 +124,8 @@ * Property used by Plate to deeply override plugins by key. | ||
*/ | ||
then?: (editor: PlateEditor<T>, plugin: WithPlatePlugin<T, P>) => Partial<PlatePlugin<T, P>>; | ||
then?: (editor: PlateEditor<T>, plugin: WithPlatePlugin<T, P>) => Partial<PlatePlugin<T, P>> | void; | ||
/** | ||
* Hook called when the editor is initialized. | ||
*/ | ||
useHooks?: (editor: PlateEditor<T>, plugin: WithPlatePlugin<T, P>) => void; | ||
/** | ||
* Editor method overriders. | ||
@@ -128,0 +132,0 @@ */ |
@@ -11,2 +11,4 @@ /** | ||
export * from './getInjectedPlugins'; | ||
export * from './getKeyByType'; | ||
export * from './getKeysByTypes'; | ||
export * from './getPlugin'; | ||
@@ -20,2 +22,4 @@ export * from './getPluginInjectProps'; | ||
export * from './getSlateClass'; | ||
export * from './hexToBase64'; | ||
export * from './mapInjectPropsToPlugin'; | ||
export * from './mergeDeepPlugins'; | ||
@@ -22,0 +26,0 @@ export * from './mergeDeepToNodes'; |
@@ -7,3 +7,3 @@ import { EditableProps } from 'slate-react/dist/components/editable'; | ||
*/ | ||
export declare const pipeDecorate: (editor: PlateEditor) => EditableProps['decorate']; | ||
export declare const pipeDecorate: (editor: PlateEditor, decorateProp?: EditableProps['decorate']) => EditableProps['decorate']; | ||
//# sourceMappingURL=pipeDecorate.d.ts.map |
@@ -17,5 +17,5 @@ import { SyntheticEvent } from 'react'; | ||
export declare const pipeHandler: <K extends keyof DOMHandlers<{}, {}>>(editor: PlateEditor, { editableProps, handlerKey, }: { | ||
editableProps?: EditableProps | undefined; | ||
editableProps?: EditableProps | null | undefined; | ||
handlerKey: K; | ||
}) => ((event: any) => void) | undefined; | ||
//# sourceMappingURL=pipeHandler.d.ts.map |
@@ -6,3 +6,3 @@ import { EditableProps } from 'slate-react/dist/components/editable'; | ||
*/ | ||
export declare const pipeRenderElement: (editor: PlateEditor, editableProps?: EditableProps | undefined) => EditableProps['renderElement']; | ||
export declare const pipeRenderElement: (editor: PlateEditor, renderElementProp?: EditableProps['renderElement']) => EditableProps['renderElement']; | ||
//# sourceMappingURL=pipeRenderElement.d.ts.map |
@@ -6,3 +6,3 @@ import { EditableProps } from 'slate-react/dist/components/editable'; | ||
*/ | ||
export declare const pipeRenderLeaf: (editor: PlateEditor, editableProps?: EditableProps | undefined) => EditableProps['renderLeaf']; | ||
export declare const pipeRenderLeaf: (editor: PlateEditor, renderLeafProp?: EditableProps['renderLeaf']) => EditableProps['renderLeaf']; | ||
//# sourceMappingURL=pipeRenderLeaf.d.ts.map |
@@ -0,7 +1,7 @@ | ||
import { PlateProps } from '../components/Plate'; | ||
import { PlateEditor } from '../types/PlateEditor'; | ||
import { PlatePlugin } from '../types/plugins/PlatePlugin'; | ||
/** | ||
* Flatten deep plugins then set editor.plugins and editor.pluginsByKey | ||
*/ | ||
export declare const setPlatePlugins: <T = {}>(editor: PlateEditor<T>, plugins: PlatePlugin<T, {}>[]) => void; | ||
export declare const setPlatePlugins: <T = {}>(editor: PlateEditor<T>, { disableCorePlugins, plugins: _plugins, }: Pick<PlateProps<T>, "plugins" | "disableCorePlugins">) => void; | ||
//# sourceMappingURL=setPlatePlugins.d.ts.map |
{ | ||
"name": "@udecode/plate-core", | ||
"version": "8.3.0", | ||
"version": "9.0.0", | ||
"description": "The core architecture of Plate – a plugin system for slate", | ||
@@ -41,5 +41,7 @@ "keywords": [ | ||
"dependencies": { | ||
"clsx": "^1.1.1", | ||
"lodash": "^4.17.21", | ||
"zustand": "^3.4.2" | ||
"@udecode/zustood": "0.4.1", | ||
"clsx": "1.1.1", | ||
"lodash": "4.17.21", | ||
"use-deep-compare": "1.1.0", | ||
"zustand": "3.6.7" | ||
}, | ||
@@ -46,0 +48,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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2317907
545
20397
10
+ Added@udecode/zustood@0.4.1
+ Addeduse-deep-compare@1.1.0
+ Added@udecode/zustood@0.4.1(transitive)
+ Addedclsx@1.1.1(transitive)
+ Addeddequal@1.0.0(transitive)
+ Addedimmer@9.0.6(transitive)
+ Addeduse-deep-compare@1.1.0(transitive)
+ Addedzustand@3.6.7(transitive)
- Removedclsx@1.2.1(transitive)
- Removedzustand@3.7.2(transitive)
Updatedclsx@1.1.1
Updatedlodash@4.17.21
Updatedzustand@3.6.7