@lofcz/platejs-core 52.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/hotkeys-DI1HPO2Q.js +115 -0
- package/dist/hotkeys-DI1HPO2Q.js.map +1 -0
- package/dist/index-NTp--CEF.d.ts +4294 -0
- package/dist/index-NTp--CEF.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +387 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +2056 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2582 -0
- package/dist/react/index.js.map +1 -0
- package/dist/static/index.d.ts +2 -0
- package/dist/static/index.js +4 -0
- package/dist/static-CVN6JhaR.js +728 -0
- package/dist/static-CVN6JhaR.js.map +1 -0
- package/dist/withSlate-1B0SfAWG.js +2823 -0
- package/dist/withSlate-1B0SfAWG.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,2056 @@
|
|
|
1
|
+
import { $i as ResetOptions, Ct as NodeComponents, Di as SlatePlugin, Et as PluginConfig, F as RenderLeafProps, I as RenderElementFn, J as BaseEditor, Ji as Descendant$1, L as RenderElementProps, M as RenderTextFn, Mr as ScrollMode, N as RenderTextProps, Nr as WithAutoScrollOptions, Oi as SlatePluginConfig, Ot as WithAnyKey, P as RenderLeafFn, Q as SlateEditor, Qi as Path$1, R as RenderChunkFn, St as NodeComponent, Tt as ParserOptions, U as BaseWithSlateOptions, Va as HandlerReturnType, Vr as InitOptions, Xi as NodeOperation$1, Y as InferPlugins, Yi as NodeEntry$1, Zi as Operation$1, _t as InferOptions, aa as TextOperation$1, at as BasePluginContext, bt as MatchRules, ct as BaseTransformOptions, ea as ScrollIntoViewOptions$1, et as AnyPluginConfig, gt as InferKey, ht as InferApi, ia as TText$1, it as BasePlugin, j as EditableProps, ja as PlateStaticProps, jr as DomConfig, ki as SlatePluginContext, kr as AutoScrollOperationsMap, kt as WithRequiredKey, mt as GetInjectNodePropsReturnType, na as TRange$1, nr as CorePluginApi, nt as BaseHtmlDeserializer, oa as Value$1, pt as GetInjectNodePropsOptions, ra as TSelection$1, ri as AnySlatePlugin, rr as CorePluginTransforms, rt as BaseInjectProps, sa as createStaticEditor, si as ExtendEditor$1, st as BaseSerializer, ta as TElement$1, tr as CorePlugin, tt as BaseDeserializer, vt as InferSelectors, yt as InferTransforms, z as RenderChunkProps, zr as InsertExitBreakOptions } from "../index-NTp--CEF";
|
|
2
|
+
import * as _platejs_slate0 from "@platejs/slate";
|
|
3
|
+
import { DecoratedRange, Descendant, DescendantIn, Editor, EditorApi, EditorTransforms, ElementEntry, NodeEntry, NodeOperation, Operation, Path, TElement, TNode, TRange, TSelection, TText, TextOperation, Value, ValueOf } from "@platejs/slate";
|
|
4
|
+
import { AnyObject, Deep2Partial, Modify, Nullable, UnionToIntersection, UnknownObject } from "@udecode/utils";
|
|
5
|
+
import { DefaultPlaceholder, Editable, RenderPlaceholderProps, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
|
|
6
|
+
import React$1, { HTMLAttributes } from "react";
|
|
7
|
+
import { HotkeysEvent, HotkeysOptions, Keys } from "@udecode/react-hotkeys";
|
|
8
|
+
import * as jotai_x98 from "jotai-x";
|
|
9
|
+
import { JotaiStore, createAtomStore, useStoreAtomState, useStoreAtomValue, useStoreSetAtom } from "jotai-x";
|
|
10
|
+
import * as jotai10 from "jotai";
|
|
11
|
+
import { Atom, atom } from "jotai";
|
|
12
|
+
import * as zustand_x0 from "zustand-x";
|
|
13
|
+
import { TCreatedStoreType, TEqualityChecker, createZustandStore, useStoreSelect, useStoreState, useStoreValue, useTracked, useTrackedStore } from "zustand-x";
|
|
14
|
+
|
|
15
|
+
//#region src/react/plugins/SlateReactExtensionPlugin.d.ts
|
|
16
|
+
declare const SlateReactExtensionPlugin: PlatePlugin<PluginConfig<"slateExtension", {
|
|
17
|
+
onNodeChange: (options: {
|
|
18
|
+
editor: SlateEditor;
|
|
19
|
+
node: Descendant$1;
|
|
20
|
+
operation: NodeOperation$1;
|
|
21
|
+
prevNode: Descendant$1;
|
|
22
|
+
}) => void;
|
|
23
|
+
onTextChange: (options: {
|
|
24
|
+
editor: SlateEditor;
|
|
25
|
+
node: Descendant$1;
|
|
26
|
+
operation: TextOperation$1;
|
|
27
|
+
prevText: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
}, {
|
|
31
|
+
redecorate: () => void;
|
|
32
|
+
}, {
|
|
33
|
+
reset: (options: ResetOptions | undefined) => void;
|
|
34
|
+
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
35
|
+
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
36
|
+
resetBlock: ((args_0?: {
|
|
37
|
+
at?: Path$1;
|
|
38
|
+
} | undefined) => true | undefined) & ((args_0?: {
|
|
39
|
+
at?: Path$1;
|
|
40
|
+
} | undefined) => true | undefined);
|
|
41
|
+
setValue: ((value?: string | Value$1 | undefined) => void) & ((value?: string | Value$1 | undefined) => void);
|
|
42
|
+
apply: <N$1 extends TElement$1 | TText$1>(operation: Operation$1<N$1>) => void;
|
|
43
|
+
}, {}>>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/react/plugins/event-editor/EventEditorPlugin.d.ts
|
|
46
|
+
declare const EventEditorPlugin: PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/react/plugins/event-editor/EventEditorStore.d.ts
|
|
49
|
+
type EventEditorState = {
|
|
50
|
+
/** Last editor id that has been blurred. */
|
|
51
|
+
blur: string | null;
|
|
52
|
+
/** Editor id that is currently being focused. */
|
|
53
|
+
focus: string | null;
|
|
54
|
+
/** Last editor id. */
|
|
55
|
+
last: string | null;
|
|
56
|
+
};
|
|
57
|
+
/** Store where the keys are event names and the values are editor ids. */
|
|
58
|
+
declare const EventEditorStore: zustand_x0.TStateApi<EventEditorState, [["zustand/mutative-x", never]], {}, {}>;
|
|
59
|
+
declare const useEventEditorValue: {
|
|
60
|
+
<K$1 extends keyof EventEditorState>(key: K$1): EventEditorState[K$1];
|
|
61
|
+
<K$1 extends never>(key: K$1, ...args: Parameters<{}[K$1]>): ReturnType<{}[K$1]>;
|
|
62
|
+
(key: "state"): EventEditorState;
|
|
63
|
+
<K$1 extends keyof EventEditorState>(key: K$1, equalityFn?: zustand_x0.TEqualityChecker<EventEditorState[K$1]> | undefined): EventEditorState[K$1];
|
|
64
|
+
<K$1 extends never>(key: K$1, ...args: [...Parameters<{}[K$1]>, (zustand_x0.TEqualityChecker<ReturnType<{}[K$1]>> | undefined)?]): ReturnType<{}[K$1]>;
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/react/plugins/event-editor/getEventPlateId.d.ts
|
|
68
|
+
declare const getEventPlateId: (id?: string) => string;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/react/plugins/event-editor/useFocusEditorEvents.d.ts
|
|
71
|
+
declare const FOCUS_EDITOR_EVENT = "focus-editor-event";
|
|
72
|
+
declare const BLUR_EDITOR_EVENT = "blur-editor-event";
|
|
73
|
+
declare const useFocusEditorEvents: ({
|
|
74
|
+
editorRef,
|
|
75
|
+
onEditorBlur,
|
|
76
|
+
onEditorFocus
|
|
77
|
+
}: {
|
|
78
|
+
editorRef: PlateEditor | null;
|
|
79
|
+
onEditorBlur?: () => void;
|
|
80
|
+
onEditorFocus?: () => void;
|
|
81
|
+
}) => void;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/react/plugins/event-editor/useFocusedLast.d.ts
|
|
84
|
+
/** Whether the current editor is the last focused editor. */
|
|
85
|
+
declare const useFocusedLast: (id?: string) => boolean;
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/react/plugins/paragraph/ParagraphPlugin.d.ts
|
|
88
|
+
declare const ParagraphPlugin: PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/react/plugins/react/ReactPlugin.d.ts
|
|
91
|
+
/** @see {@link withReact} */
|
|
92
|
+
declare const ReactPlugin: PlatePlugin<PluginConfig<"dom", {
|
|
93
|
+
scrollMode?: ScrollMode;
|
|
94
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
95
|
+
scrollOptions?: ScrollIntoViewOptions$1;
|
|
96
|
+
}, {
|
|
97
|
+
isScrolling: () => boolean;
|
|
98
|
+
}, {
|
|
99
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
100
|
+
}, {}>>;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/react/plugins/react/withPlateReact.d.ts
|
|
103
|
+
declare const withPlateReact: ExtendEditor$1<DomConfig>;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/react/editor/withPlate.d.ts
|
|
106
|
+
type PlateCorePlugin = CorePlugin | typeof EventEditorPlugin | typeof SlateReactExtensionPlugin;
|
|
107
|
+
type WithPlateOptions<V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin> = BaseWithSlateOptions<P$1> & Pick<Partial<AnyPlatePlugin>, 'api' | 'decorate' | 'extendEditor' | 'handlers' | 'inject' | 'normalizeInitialValue' | 'options' | 'override' | 'priority' | 'render' | 'shortcuts' | 'transforms' | 'useHooks'> & {
|
|
108
|
+
value?: ((editor: PlateEditor) => Promise<V$1> | V$1) | V$1 | string;
|
|
109
|
+
rootPlugin?: (plugin: AnyPlatePlugin) => AnyPlatePlugin;
|
|
110
|
+
onReady?: (ctx: {
|
|
111
|
+
editor: PlateEditor;
|
|
112
|
+
isAsync: boolean;
|
|
113
|
+
value: V$1;
|
|
114
|
+
}) => void;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Applies Plate enhancements to an editor instance (React version).
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* This function supports React-specific features including component rendering,
|
|
121
|
+
* event handlers, and React hooks integration.
|
|
122
|
+
* @see {@link createPlateEditor} for a higher-level React editor creation function.
|
|
123
|
+
* @see {@link usePlateEditor} for a memoized version in React components.
|
|
124
|
+
* @see {@link withSlate} for the non-React version of editor enhancement.
|
|
125
|
+
*/
|
|
126
|
+
declare const withPlate: <V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin>(e: Editor, options?: WithPlateOptions<V$1, P$1>) => TPlateEditor<V$1, InferPlugins<P$1[]>>;
|
|
127
|
+
type CreatePlateEditorOptions<V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin> = WithPlateOptions<V$1, P$1> & {
|
|
128
|
+
/**
|
|
129
|
+
* Initial editor to be extended with `withPlate`.
|
|
130
|
+
*
|
|
131
|
+
* @default createEditor()
|
|
132
|
+
*/
|
|
133
|
+
editor?: Editor;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Creates a Plate editor (React version).
|
|
137
|
+
*
|
|
138
|
+
* This function creates a fully configured Plate editor instance with
|
|
139
|
+
* React-specific enhancements including component rendering, event handlers,
|
|
140
|
+
* and hooks integration. It applies all specified plugins and configurations to
|
|
141
|
+
* create a functional editor.
|
|
142
|
+
*
|
|
143
|
+
* Examples:
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* const editor = createPlateEditor({
|
|
147
|
+
* plugins: [ParagraphPlugin, HeadingPlugin],
|
|
148
|
+
* value: [{ type: 'p', children: [{ text: 'Hello world!' }] }],
|
|
149
|
+
* });
|
|
150
|
+
*
|
|
151
|
+
* // Editor with custom components
|
|
152
|
+
* const editor = createPlateEditor({
|
|
153
|
+
* plugins: [ParagraphPlugin.withComponent(ParagraphElement)],
|
|
154
|
+
* components: { [CodePlugin.key]: CodeLeaf },
|
|
155
|
+
* });
|
|
156
|
+
*
|
|
157
|
+
* // Editor with React-specific options
|
|
158
|
+
* const editor = createPlateEditor({
|
|
159
|
+
* plugins: [ParagraphPlugin],
|
|
160
|
+
* handlers: { onKeyDown: customKeyHandler },
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @see {@link createSlateEditor} for a non-React version of editor creation.
|
|
165
|
+
* @see {@link usePlateEditor} for a memoized version in React components.
|
|
166
|
+
* @see {@link withPlate} for the underlying function that applies Plate enhancements to an editor.
|
|
167
|
+
*/
|
|
168
|
+
declare const createPlateEditor: <V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin>({
|
|
169
|
+
editor,
|
|
170
|
+
...options
|
|
171
|
+
}?: CreatePlateEditorOptions<V$1, P$1>) => TPlateEditor<V$1, InferPlugins<P$1[]>>;
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/react/editor/PlateEditor.d.ts
|
|
174
|
+
type PlateEditor = BaseEditor & {
|
|
175
|
+
api: EditorApi & UnionToIntersection<InferApi<PlateCorePlugin>>;
|
|
176
|
+
meta: BaseEditor['meta'] & {
|
|
177
|
+
pluginList: AnyEditorPlatePlugin[];
|
|
178
|
+
shortcuts: Shortcuts;
|
|
179
|
+
};
|
|
180
|
+
plugins: Record<string, AnyEditorPlatePlugin>;
|
|
181
|
+
tf: EditorTransforms & UnionToIntersection<InferTransforms<PlateCorePlugin>>;
|
|
182
|
+
transforms: EditorTransforms & UnionToIntersection<InferTransforms<PlateCorePlugin>>;
|
|
183
|
+
getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => PlateEditor['api'] & InferApi<C>;
|
|
184
|
+
getPlugin: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => C extends {
|
|
185
|
+
node: any;
|
|
186
|
+
} ? C : EditorPlatePlugin<C>;
|
|
187
|
+
getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => PlateEditor['tf'] & InferTransforms<C>;
|
|
188
|
+
uid?: string;
|
|
189
|
+
};
|
|
190
|
+
type FilterKeys<T, K$1 extends keyof T> = { [P in keyof T as Exclude<P, K$1>]: T[P] };
|
|
191
|
+
type TPlateEditor<V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin> = FilterKeys<PlateEditor, 'children' | 'operations'> & {
|
|
192
|
+
api: EditorApi<V$1> & UnionToIntersection<InferApi<P$1 | PlateCorePlugin>>;
|
|
193
|
+
children: V$1;
|
|
194
|
+
meta: BaseEditor['meta'] & {
|
|
195
|
+
pluginList: P$1[];
|
|
196
|
+
shortcuts: Shortcuts;
|
|
197
|
+
};
|
|
198
|
+
operations: Operation<DescendantIn<V$1>>[];
|
|
199
|
+
plugins: { [K in P$1['key']]: Extract<P$1, {
|
|
200
|
+
key: K;
|
|
201
|
+
}> };
|
|
202
|
+
tf: EditorTransforms<V$1> & UnionToIntersection<InferTransforms<P$1 | PlateCorePlugin>>;
|
|
203
|
+
transforms: EditorTransforms<V$1> & UnionToIntersection<InferTransforms<P$1 | PlateCorePlugin>>;
|
|
204
|
+
getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TPlateEditor<V$1>['api'] & InferApi<C>;
|
|
205
|
+
getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TPlateEditor<V$1>['tf'] & InferTransforms<C>;
|
|
206
|
+
};
|
|
207
|
+
type KeyofPlugins<T extends AnyPluginConfig> = (string & {}) | InferKey<PlateCorePlugin | T>;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/react/plugin/PlatePlugin.d.ts
|
|
210
|
+
type AnyEditorPlatePlugin = EditorPlatePlugin<AnyPluginConfig>;
|
|
211
|
+
type AnyPlatePlugin = PlatePlugin<AnyPluginConfig>;
|
|
212
|
+
/**
|
|
213
|
+
* Property used by Plate to decorate editor ranges. If the function returns
|
|
214
|
+
* undefined then no ranges are modified. If the function returns an array the
|
|
215
|
+
* returned ranges are merged with the ranges called by other plugins.
|
|
216
|
+
*/
|
|
217
|
+
type Decorate<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & {
|
|
218
|
+
entry: NodeEntry;
|
|
219
|
+
}) => DecoratedRange[] | undefined;
|
|
220
|
+
type Deserializer<C extends AnyPluginConfig = PluginConfig> = BaseDeserializer & {
|
|
221
|
+
parse?: (options: PlatePluginContext<C> & {
|
|
222
|
+
element: any;
|
|
223
|
+
}) => Partial<Descendant> | undefined | void;
|
|
224
|
+
query?: (options: PlatePluginContext<C> & {
|
|
225
|
+
element: any;
|
|
226
|
+
}) => boolean;
|
|
227
|
+
};
|
|
228
|
+
type EditableSiblingComponent = (editableProps: EditableProps) => React$1.ReactElement<any> | null;
|
|
229
|
+
type EditorPlatePlugin<C extends AnyPluginConfig = PluginConfig> = Omit<PlatePlugin<C>, keyof PlatePluginMethods | 'override' | 'plugins'>;
|
|
230
|
+
/** Plate plugin overriding the `editor` methods. Naming convention is `with*`. */
|
|
231
|
+
type ExtendEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => PlateEditor;
|
|
232
|
+
type ExtendEditorApi<C extends AnyPluginConfig = PluginConfig, EA = {}> = (ctx: PlatePluginContext<C>) => EA & Deep2Partial<EditorApi & CorePluginApi> & { [K in keyof InferApi<C>]?: InferApi<C>[K] extends ((...args: any[]) => any) ? (...args: Parameters<InferApi<C>[K]>) => ReturnType<InferApi<C>[K]> : InferApi<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferApi<C>[K]]?: (...args: Parameters<InferApi<C>[K][N]>) => ReturnType<InferApi<C>[K][N]> } : never };
|
|
233
|
+
type ExtendEditorTransforms<C extends AnyPluginConfig = PluginConfig, ET = {}> = (ctx: PlatePluginContext<C>) => ET & Deep2Partial<EditorTransforms & CorePluginTransforms> & { [K in keyof InferTransforms<C>]?: InferTransforms<C>[K] extends ((...args: any[]) => any) ? (...args: Parameters<InferTransforms<C>[K]>) => ReturnType<InferTransforms<C>[K]> : InferTransforms<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferTransforms<C>[K]]?: (...args: Parameters<InferTransforms<C>[K][N]>) => ReturnType<InferTransforms<C>[K][N]> } : never };
|
|
234
|
+
type HtmlDeserializer<C extends AnyPluginConfig = PluginConfig> = BaseHtmlDeserializer & {
|
|
235
|
+
parse?: (options: PlatePluginContext<C> & {
|
|
236
|
+
element: HTMLElement;
|
|
237
|
+
node: AnyObject;
|
|
238
|
+
}) => Partial<Descendant> | undefined | void;
|
|
239
|
+
query?: (options: PlatePluginContext<C> & {
|
|
240
|
+
element: HTMLElement;
|
|
241
|
+
}) => boolean;
|
|
242
|
+
};
|
|
243
|
+
type HtmlReactSerializer<C extends AnyPluginConfig = PluginConfig> = {
|
|
244
|
+
parse?: React$1.FC<PlateElementProps<TElement, C> & PlateLeafProps<TText, C>>;
|
|
245
|
+
query?: (options: PlateElementProps) => boolean;
|
|
246
|
+
};
|
|
247
|
+
type HtmlSerializer<C extends AnyPluginConfig = PluginConfig> = {
|
|
248
|
+
parse?: (options: PlatePluginContext<C> & {
|
|
249
|
+
node: Descendant;
|
|
250
|
+
}) => string;
|
|
251
|
+
query?: (options: PlatePluginContext<C> & {
|
|
252
|
+
node: Descendant;
|
|
253
|
+
}) => boolean;
|
|
254
|
+
};
|
|
255
|
+
type InferConfig<P$1> = P$1 extends PlatePlugin<infer C> | SlatePlugin<infer C> ? C : never;
|
|
256
|
+
/** Properties used by Plate to inject props into any {@link NodeComponent}. */
|
|
257
|
+
type InjectNodeProps<C extends AnyPluginConfig = PluginConfig> = BaseInjectProps & {
|
|
258
|
+
/** Whether to inject the props. If true, overrides all other checks. */
|
|
259
|
+
query?: (options: NonNullable<NonNullable<InjectNodeProps>> & PlatePluginContext<C> & {
|
|
260
|
+
nodeProps: GetInjectNodePropsOptions;
|
|
261
|
+
}) => boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Transform the className.
|
|
264
|
+
*
|
|
265
|
+
* @default clsx(className, classNames[value])
|
|
266
|
+
*/
|
|
267
|
+
transformClassName?: (options: TransformOptions<C>) => any;
|
|
268
|
+
/**
|
|
269
|
+
* Transform the node value for the style or className.
|
|
270
|
+
*
|
|
271
|
+
* @default nodeValue
|
|
272
|
+
*/
|
|
273
|
+
transformNodeValue?: (options: TransformOptions<C>) => any;
|
|
274
|
+
/** Transform the injected props. */
|
|
275
|
+
transformProps?: (options: TransformOptions<C> & {
|
|
276
|
+
props: GetInjectNodePropsReturnType;
|
|
277
|
+
}) => AnyObject | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* Transform the style.
|
|
280
|
+
*
|
|
281
|
+
* @default { ...style, [styleKey]: value }
|
|
282
|
+
*/
|
|
283
|
+
transformStyle?: (options: TransformOptions<C>) => CSSStyleDeclaration;
|
|
284
|
+
};
|
|
285
|
+
type LeafNodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject;
|
|
286
|
+
/**
|
|
287
|
+
* Property used by Plate to override node `component` props. If function, its
|
|
288
|
+
* returning value will be shallow merged to the old props, with the old props
|
|
289
|
+
* as parameter. If object, its value will be shallow merged to the old props.
|
|
290
|
+
*/
|
|
291
|
+
type NodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateElementProps<TElement, C> & PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject;
|
|
292
|
+
/** @deprecated Use {@link RenderNodeWrapper} instead. */
|
|
293
|
+
type NodeWrapperComponent<C extends AnyPluginConfig = PluginConfig> = (props: NodeWrapperComponentProps<C>) => NodeWrapperComponentReturnType<C>;
|
|
294
|
+
/** @deprecated Use {@link RenderNodeWrapperProps} instead. */
|
|
295
|
+
interface NodeWrapperComponentProps<C extends AnyPluginConfig = PluginConfig> extends PlateElementProps<TElement, C> {
|
|
296
|
+
key: string;
|
|
297
|
+
}
|
|
298
|
+
/** @deprecated Use {@link RenderNodeWrapperFunction} instead. */
|
|
299
|
+
type NodeWrapperComponentReturnType<C extends AnyPluginConfig = PluginConfig> = React$1.FC<PlateElementProps<TElement, C>> | undefined;
|
|
300
|
+
type NormalizeInitialValue<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & {
|
|
301
|
+
value: Value;
|
|
302
|
+
}) => void;
|
|
303
|
+
/**
|
|
304
|
+
* Function called whenever a change occurs in the editor. Return `false` to
|
|
305
|
+
* prevent calling the next plugin handler.
|
|
306
|
+
*
|
|
307
|
+
* @see {@link SlatePropsOnChange}
|
|
308
|
+
*/
|
|
309
|
+
type OnChange<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & {
|
|
310
|
+
value: Value;
|
|
311
|
+
}) => HandlerReturnType;
|
|
312
|
+
/**
|
|
313
|
+
* Function called whenever a node operation occurs in the editor. Return `true`
|
|
314
|
+
* to prevent calling the next plugin handler.
|
|
315
|
+
*/
|
|
316
|
+
type OnNodeChange<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & {
|
|
317
|
+
node: Descendant;
|
|
318
|
+
operation: NodeOperation;
|
|
319
|
+
prevNode: Descendant;
|
|
320
|
+
}) => HandlerReturnType;
|
|
321
|
+
/**
|
|
322
|
+
* Function called whenever a text operation occurs in the editor. Return `true`
|
|
323
|
+
* to prevent calling the next plugin handler.
|
|
324
|
+
*/
|
|
325
|
+
type OnTextChange<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & {
|
|
326
|
+
node: Descendant;
|
|
327
|
+
operation: TextOperation;
|
|
328
|
+
prevText: string;
|
|
329
|
+
text: string;
|
|
330
|
+
}) => HandlerReturnType;
|
|
331
|
+
type OverrideEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => {
|
|
332
|
+
api?: Deep2Partial<EditorApi & CorePluginApi> & { [K in keyof InferApi<C>]?: InferApi<C>[K] extends ((...args: any[]) => any) ? (...args: Parameters<InferApi<C>[K]>) => ReturnType<InferApi<C>[K]> : InferApi<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferApi<C>[K]]?: (...args: Parameters<InferApi<C>[K][N]>) => ReturnType<InferApi<C>[K][N]> } : never };
|
|
333
|
+
transforms?: Deep2Partial<EditorTransforms & CorePluginTransforms> & { [K in keyof InferTransforms<C>]?: InferTransforms<C>[K] extends ((...args: any[]) => any) ? (...args: Parameters<InferTransforms<C>[K]>) => ReturnType<InferTransforms<C>[K]> : InferTransforms<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferTransforms<C>[K]]?: (...args: Parameters<InferTransforms<C>[K][N]>) => ReturnType<InferTransforms<C>[K][N]> } : never };
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Used by parser plugins like html to deserialize inserted data to a slate
|
|
337
|
+
* fragment. The fragment will be inserted to the editor if not empty.
|
|
338
|
+
*/
|
|
339
|
+
type Parser<C extends AnyPluginConfig = PluginConfig> = {
|
|
340
|
+
/** Format to get data. Example data types are text/plain and text/uri-list. */
|
|
341
|
+
format?: string[] | string;
|
|
342
|
+
mimeTypes?: string[];
|
|
343
|
+
/** Deserialize data to fragment */
|
|
344
|
+
deserialize?: (options: ParserOptions & PlatePluginContext<C>) => Descendant[] | undefined;
|
|
345
|
+
/**
|
|
346
|
+
* Function called on `editor.tf.insertData` just before
|
|
347
|
+
* `editor.tf.insertFragment`. Default: if the block above the selection is
|
|
348
|
+
* empty and the first fragment node type is not inline, set the selected node
|
|
349
|
+
* type to the first fragment node type.
|
|
350
|
+
*
|
|
351
|
+
* @returns If true, the next handlers will be skipped.
|
|
352
|
+
*/
|
|
353
|
+
preInsert?: (options: ParserOptions & PlatePluginContext<C> & {
|
|
354
|
+
fragment: Descendant[];
|
|
355
|
+
}) => HandlerReturnType;
|
|
356
|
+
/** Query to skip this plugin. */
|
|
357
|
+
query?: (options: ParserOptions & PlatePluginContext<C>) => boolean;
|
|
358
|
+
/** Transform the inserted data. */
|
|
359
|
+
transformData?: (options: ParserOptions & PlatePluginContext<C>) => string;
|
|
360
|
+
/** Transform the fragment to insert. */
|
|
361
|
+
transformFragment?: (options: ParserOptions & PlatePluginContext<C> & {
|
|
362
|
+
fragment: Descendant[];
|
|
363
|
+
}) => Descendant[];
|
|
364
|
+
};
|
|
365
|
+
/** The `PlatePlugin` interface is a React interface for all plugins. */
|
|
366
|
+
type PlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nullable<{
|
|
367
|
+
/** @see {@link Decorate} */
|
|
368
|
+
decorate?: Decorate<WithAnyKey<C>>;
|
|
369
|
+
/** @see {@link ExtendEditor} */
|
|
370
|
+
extendEditor?: ExtendEditor<WithAnyKey<C>>;
|
|
371
|
+
/** Normalize initial value before passing it into the editor. */
|
|
372
|
+
normalizeInitialValue?: NormalizeInitialValue<WithAnyKey<C>>;
|
|
373
|
+
/** @see {@link UseHooks} */
|
|
374
|
+
useHooks?: UseHooks<WithAnyKey<C>>;
|
|
375
|
+
}> & PlatePluginMethods<C> & {
|
|
376
|
+
/**
|
|
377
|
+
* Handlers called whenever the corresponding event occurs in the editor.
|
|
378
|
+
* Event handlers can return a boolean flag to specify whether the event
|
|
379
|
+
* can be treated as being handled. If it returns `true`, the next
|
|
380
|
+
* handlers will not be called.
|
|
381
|
+
*/
|
|
382
|
+
handlers: Nullable<DOMHandlers<WithAnyKey<C>> & {
|
|
383
|
+
/** @see {@link OnChange} */
|
|
384
|
+
onChange?: OnChange<WithAnyKey<C>>;
|
|
385
|
+
/** @see {@link OnNodeChange} */
|
|
386
|
+
onNodeChange?: OnNodeChange<WithAnyKey<C>>;
|
|
387
|
+
/** @see {@link OnTextChange} */
|
|
388
|
+
onTextChange?: OnTextChange<WithAnyKey<C>>;
|
|
389
|
+
}>;
|
|
390
|
+
/** Plugin injection. */
|
|
391
|
+
inject: Nullable<{
|
|
392
|
+
nodeProps?: InjectNodeProps<WithAnyKey<C>>;
|
|
393
|
+
/**
|
|
394
|
+
* Property that can be used by a plugin to allow other plugins to
|
|
395
|
+
* inject code. For example, if multiple plugins have defined
|
|
396
|
+
* `inject.editor.tf.insertData.transformData` for `key=HtmlPlugin.key`,
|
|
397
|
+
* `insertData` plugin will call all of these `transformData` for
|
|
398
|
+
* `HtmlPlugin.key` plugin. Differs from `override.plugins` as this is
|
|
399
|
+
* not overriding any plugin.
|
|
400
|
+
*/
|
|
401
|
+
plugins?: Record<string, Partial<EditorPlatePlugin<AnyPluginConfig>>>;
|
|
402
|
+
/**
|
|
403
|
+
* A function that returns a plugin config to be injected into other
|
|
404
|
+
* plugins `inject.plugins` specified by targetPlugins.
|
|
405
|
+
*/
|
|
406
|
+
targetPluginToInject?: (ctx: PlatePluginContext<C> & {
|
|
407
|
+
targetPlugin: string;
|
|
408
|
+
}) => Partial<PlatePlugin<AnyPluginConfig>>;
|
|
409
|
+
}>;
|
|
410
|
+
node: {
|
|
411
|
+
/** Override `data-slate-leaf` element attributes */
|
|
412
|
+
leafProps?: LeafNodeProps<WithAnyKey<C>>;
|
|
413
|
+
/** Override node attributes */
|
|
414
|
+
props?: NodeProps<WithAnyKey<C>>;
|
|
415
|
+
/** Override `data-slate-node="text"` element attributes */
|
|
416
|
+
textProps?: TextNodeProps<WithAnyKey<C>>;
|
|
417
|
+
};
|
|
418
|
+
override: {
|
|
419
|
+
/** Replace plugin {@link NodeComponent} by key. */
|
|
420
|
+
components?: NodeComponents;
|
|
421
|
+
/** Extend {@link PlatePlugin} by key. */
|
|
422
|
+
plugins?: Record<string, Partial<EditorPlatePlugin<AnyPluginConfig>>>;
|
|
423
|
+
};
|
|
424
|
+
/** @see {@link Parser} */
|
|
425
|
+
parser: Nullable<Parser<WithAnyKey<C>>>;
|
|
426
|
+
parsers: (Record<string, {
|
|
427
|
+
/** @see {@link Deserializer} */
|
|
428
|
+
deserializer?: Deserializer<WithAnyKey<C>>;
|
|
429
|
+
/** @see {@link Serializer} */
|
|
430
|
+
serializer?: Serializer<WithAnyKey<C>>;
|
|
431
|
+
}> & {
|
|
432
|
+
html?: never;
|
|
433
|
+
htmlReact?: never;
|
|
434
|
+
}) | {
|
|
435
|
+
html?: Nullable<{
|
|
436
|
+
/** @see {@link HtmlDeserializer} */
|
|
437
|
+
deserializer?: HtmlDeserializer<WithAnyKey<C>>;
|
|
438
|
+
/** @see {@link HtmlSerializer} */
|
|
439
|
+
serializer?: HtmlSerializer<WithAnyKey<C>>;
|
|
440
|
+
}>;
|
|
441
|
+
htmlReact?: Nullable<{
|
|
442
|
+
/** Function to deserialize HTML to Slate nodes using React. */
|
|
443
|
+
serializer?: HtmlReactSerializer<WithAnyKey<C>>;
|
|
444
|
+
}>;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Recursive plugin support to allow having multiple plugins in a single
|
|
448
|
+
* plugin. Plate eventually flattens all the plugins into the editor.
|
|
449
|
+
*/
|
|
450
|
+
plugins: any[];
|
|
451
|
+
render: Nullable<{
|
|
452
|
+
/**
|
|
453
|
+
* When other plugins' node components are rendered, this function can
|
|
454
|
+
* return an optional wrapper function that turns a node's props to a
|
|
455
|
+
* wrapper React node as its parent. Useful for wrapping or decorating
|
|
456
|
+
* nodes with additional UI elements.
|
|
457
|
+
*
|
|
458
|
+
* NOTE: The function can run React hooks. NOTE: Do not run React hooks
|
|
459
|
+
* in the wrapper function. It is not equivalent to a React component.
|
|
460
|
+
*/
|
|
461
|
+
aboveNodes?: RenderNodeWrapper<WithAnyKey<C>>;
|
|
462
|
+
/** Renders a component after the `Container` component. */
|
|
463
|
+
afterContainer?: EditableSiblingComponent;
|
|
464
|
+
/**
|
|
465
|
+
* Renders a component after the `Editable` component. This is the last
|
|
466
|
+
* render position within the editor structure.
|
|
467
|
+
*/
|
|
468
|
+
afterEditable?: EditableSiblingComponent;
|
|
469
|
+
/** Renders a component before the `Container` component. */
|
|
470
|
+
beforeContainer?: EditableSiblingComponent;
|
|
471
|
+
/** Renders a component before the `Editable` component. */
|
|
472
|
+
beforeEditable?: EditableSiblingComponent;
|
|
473
|
+
/**
|
|
474
|
+
* When other plugins' node components are rendered, this function can
|
|
475
|
+
* return an optional wrapper function that turns a node's props to a
|
|
476
|
+
* wrapper React node. The wrapper node is the node's child and its
|
|
477
|
+
* original children's parent. Useful for wrapping or decorating nodes
|
|
478
|
+
* with additional UI elements.
|
|
479
|
+
*
|
|
480
|
+
* NOTE: The function can run React hooks. NOTE: Do not run React hooks
|
|
481
|
+
* in the wrapper function. It is not equivalent to a React component.
|
|
482
|
+
*/
|
|
483
|
+
belowNodes?: RenderNodeWrapper<WithAnyKey<C>>;
|
|
484
|
+
/**
|
|
485
|
+
* Function to render content below the root element but above its
|
|
486
|
+
* children. Similar to belowNodes but renders directly in the element
|
|
487
|
+
* rather than wrapping. Multiple plugins can provide this, and all
|
|
488
|
+
* their content will be rendered in sequence.
|
|
489
|
+
*/
|
|
490
|
+
belowRootNodes?: (props: PlateElementProps<TElement, C>) => React$1.ReactNode;
|
|
491
|
+
}>;
|
|
492
|
+
rules: {
|
|
493
|
+
/**
|
|
494
|
+
* Function to determine if this plugin's rules should apply to a node.
|
|
495
|
+
* Used to override behavior based on node properties beyond just type
|
|
496
|
+
* matching.
|
|
497
|
+
*
|
|
498
|
+
* Example: List plugin sets `match: ({ node }) => !!node.listStyleType`
|
|
499
|
+
* to override paragraph behavior when the paragraph is a list item.
|
|
500
|
+
*
|
|
501
|
+
* @default type === node.type
|
|
502
|
+
*/
|
|
503
|
+
match?: (options: {
|
|
504
|
+
node: TElement;
|
|
505
|
+
path: Path;
|
|
506
|
+
rule: MatchRules;
|
|
507
|
+
} & PlatePluginContext<C>) => boolean;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Keyboard shortcuts configuration mapping shortcut names to their key
|
|
511
|
+
* combinations and handlers. Each shortcut can link to a transform
|
|
512
|
+
* method, an API method, or use a custom handler function.
|
|
513
|
+
*/
|
|
514
|
+
shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], Shortcut | null>>;
|
|
515
|
+
useOptionsStore: TCreatedStoreType<C['options'], [['zustand/mutative-x', never]]>;
|
|
516
|
+
};
|
|
517
|
+
type PlatePluginConfig<K$1 extends string = any, O = {}, A$1 = {}, T = {}, S = {}, EO = {}, EA = {}, ET = {}, ES = {}> = Partial<Omit<PlatePlugin<PluginConfig<K$1, Partial<O>, A$1, T, S>>, keyof PlatePluginMethods | 'api' | 'node' | 'optionsStore' | 'transforms' | 'useOptionsStore'> & {
|
|
518
|
+
api: EA;
|
|
519
|
+
node: Partial<PlatePlugin<PluginConfig<K$1, O, A$1, T, S>>['node']>;
|
|
520
|
+
options: EO;
|
|
521
|
+
selectors: ES;
|
|
522
|
+
transforms: ET;
|
|
523
|
+
}>;
|
|
524
|
+
type PlatePluginContext<C extends AnyPluginConfig = PluginConfig, E extends PlateEditor = PlateEditor> = BasePluginContext<C> & {
|
|
525
|
+
editor: E;
|
|
526
|
+
plugin: EditorPlatePlugin<C>;
|
|
527
|
+
};
|
|
528
|
+
type PlatePluginMethods<C extends AnyPluginConfig = PluginConfig> = {
|
|
529
|
+
__apiExtensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[];
|
|
530
|
+
__configuration: ((ctx: PlatePluginContext<AnyPluginConfig>) => any) | null;
|
|
531
|
+
__extensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[];
|
|
532
|
+
__selectorExtensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[];
|
|
533
|
+
clone: () => PlatePlugin<C>;
|
|
534
|
+
configure: (config: ((ctx: PlatePluginContext<C>) => PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) | PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) => PlatePlugin<C>;
|
|
535
|
+
configurePlugin: <P$1 extends AnyPlatePlugin | AnySlatePlugin>(plugin: Partial<P$1>, config: (P$1 extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>> : SlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>>) | ((ctx: P$1 extends AnyPlatePlugin ? PlatePluginContext<P$1> : SlatePluginContext<P$1>) => P$1 extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>> : SlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>>)) => PlatePlugin<C>;
|
|
536
|
+
extend: <EO = {}, EA = {}, ET = {}, ES = {}>(extendConfig: ((ctx: PlatePluginContext<C>) => PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) | PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) => PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, InferSelectors<C>>>;
|
|
537
|
+
extendApi: <EA extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => EA) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C> & Record<C['key'], EA>, InferTransforms<C>, InferSelectors<C>>>;
|
|
538
|
+
/**
|
|
539
|
+
* Extends the plugin's API with new methods or nested objects.
|
|
540
|
+
*
|
|
541
|
+
* This method allows you to add new functionality to the plugin's API or
|
|
542
|
+
* extend existing ones. You can add top-level methods, nested objects with
|
|
543
|
+
* methods, or extend existing nested objects. The types of existing methods
|
|
544
|
+
* and nested objects are preserved, while new ones are inferred.
|
|
545
|
+
*
|
|
546
|
+
* @remarks
|
|
547
|
+
* - New methods can be added at the top level or within nested objects.
|
|
548
|
+
* - Existing methods can be overridden, but their parameter and return types
|
|
549
|
+
* must match the original.
|
|
550
|
+
* - When extending nested objects, you don't need to specify all existing
|
|
551
|
+
* properties; they will be preserved.
|
|
552
|
+
* - Only one level of nesting is supported for API objects.
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```typescript
|
|
556
|
+
* const extendedPlugin = basePlugin.extendEditorApi(({ plugin }) => ({
|
|
557
|
+
* newMethod: (param: string) => param.length,
|
|
558
|
+
* existingMethod: (n) => n * 2, // Must match original signature
|
|
559
|
+
* nested: {
|
|
560
|
+
* newNestedMethod: () => 'new nested method',
|
|
561
|
+
* },
|
|
562
|
+
* }));
|
|
563
|
+
* ```;
|
|
564
|
+
*
|
|
565
|
+
* @template EA - The type of the extended API, inferred from the returned
|
|
566
|
+
* object.
|
|
567
|
+
* @param extendedApi - A function that returns an object with the new or
|
|
568
|
+
* extended API methods.
|
|
569
|
+
* @returns A new instance of the plugin with the extended API.
|
|
570
|
+
*/
|
|
571
|
+
extendEditorApi: <EA extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorApi<C, EA>) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, { [K in keyof (EA & InferApi<C>)]: (EA & InferApi<C>)[K] extends ((...args: any[]) => any) ? (EA & InferApi<C>)[K] : { [N in keyof (EA & InferApi<C>)[K]]: (EA & InferApi<C>)[K][N] } }, InferTransforms<C>, InferSelectors<C>>>;
|
|
572
|
+
extendEditorTransforms: <ET extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorTransforms<C, ET>) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, { [K in keyof (ET & InferTransforms<C>)]: (ET & InferTransforms<C>)[K] extends ((...args: any[]) => any) ? (ET & InferTransforms<C>)[K] : { [N in keyof (ET & InferTransforms<C>)[K]]: (ET & InferTransforms<C>)[K][N] } }, InferSelectors<C>>>;
|
|
573
|
+
extendPlugin: <P$1 extends AnyPlatePlugin | AnySlatePlugin, EO = {}, EA = {}, ET = {}>(plugin: Partial<P$1>, extendConfig: (P$1 extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>, EO, EA, ET> : SlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>, EO, EA, ET>) | ((ctx: P$1 extends AnyPlatePlugin ? PlatePluginContext<P$1> : SlatePluginContext<P$1>) => P$1 extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>, EO, EA, ET> : SlatePluginConfig<any, InferOptions<P$1>, InferApi<P$1>, InferTransforms<P$1>, InferSelectors<P$1>, EO, EA, ET>)) => PlatePlugin<C>;
|
|
574
|
+
extendSelectors: <ES extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => ES) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, ES & InferSelectors<C>>>;
|
|
575
|
+
extendTransforms: <ET extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => ET) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C> & Record<C['key'], ET>, InferSelectors<C>>>;
|
|
576
|
+
overrideEditor: (override: OverrideEditor<C>) => PlatePlugin<C>;
|
|
577
|
+
/** Returns a new instance of the plugin with the component. */
|
|
578
|
+
withComponent: (component: NodeComponent) => PlatePlugin<C>;
|
|
579
|
+
__resolved?: boolean;
|
|
580
|
+
};
|
|
581
|
+
type PlatePlugins = AnyPlatePlugin[];
|
|
582
|
+
type RenderNodeWrapper<C extends AnyPluginConfig = PluginConfig> = (props: RenderNodeWrapperProps<C>) => RenderNodeWrapperFunction;
|
|
583
|
+
type RenderNodeWrapperFunction = ((elementProps: PlateElementProps) => React$1.ReactNode) | undefined;
|
|
584
|
+
interface RenderNodeWrapperProps<C extends AnyPluginConfig = PluginConfig> extends PlateElementProps<TElement, C> {
|
|
585
|
+
key: string;
|
|
586
|
+
}
|
|
587
|
+
type Serializer<C extends AnyPluginConfig = PluginConfig> = BaseSerializer & {
|
|
588
|
+
parser?: (options: PlatePluginContext<C> & {
|
|
589
|
+
node: Descendant;
|
|
590
|
+
}) => any;
|
|
591
|
+
query?: (options: PlatePluginContext<C> & {
|
|
592
|
+
node: Descendant;
|
|
593
|
+
}) => boolean;
|
|
594
|
+
};
|
|
595
|
+
type Shortcut = HotkeysOptions & {
|
|
596
|
+
keys?: Keys | null;
|
|
597
|
+
priority?: number;
|
|
598
|
+
handler?: (ctx: {
|
|
599
|
+
editor: PlateEditor;
|
|
600
|
+
event: KeyboardEvent;
|
|
601
|
+
eventDetails: HotkeysEvent;
|
|
602
|
+
}) => boolean | void;
|
|
603
|
+
};
|
|
604
|
+
type Shortcuts = Record<string, Shortcut | null>;
|
|
605
|
+
type TextNodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject;
|
|
606
|
+
type TransformOptions<C extends AnyPluginConfig = PluginConfig> = BaseTransformOptions & PlatePluginContext<C>;
|
|
607
|
+
/** Hook called when the editor is initialized. */
|
|
608
|
+
type UseHooks<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => void;
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/react/plugin/DOMHandlers.d.ts
|
|
611
|
+
type DOMHandler<C extends AnyPluginConfig = PluginConfig, EV = {}> = (ctx: PlatePluginContext<C> & {
|
|
612
|
+
event: EV;
|
|
613
|
+
}) => HandlerReturnType;
|
|
614
|
+
type DOMHandlers<C extends AnyPluginConfig = PluginConfig> = {
|
|
615
|
+
onAbort?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
616
|
+
onAbortCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
617
|
+
onAnimationEnd?: DOMHandler<C, React$1.AnimationEvent>;
|
|
618
|
+
onAnimationEndCapture?: DOMHandler<C, React$1.AnimationEvent>;
|
|
619
|
+
onAnimationIteration?: DOMHandler<C, React$1.AnimationEvent>;
|
|
620
|
+
onAnimationIterationCapture?: DOMHandler<C, React$1.AnimationEvent>;
|
|
621
|
+
onAnimationStart?: DOMHandler<C, React$1.AnimationEvent>;
|
|
622
|
+
onAnimationStartCapture?: DOMHandler<C, React$1.AnimationEvent>;
|
|
623
|
+
onAuxClick?: DOMHandler<C, React$1.MouseEvent>;
|
|
624
|
+
onAuxClickCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
625
|
+
onBeforeInput?: DOMHandler<C, React$1.FormEvent>;
|
|
626
|
+
onBeforeInputCapture?: DOMHandler<C, React$1.FormEvent>;
|
|
627
|
+
onBlur?: DOMHandler<C, React$1.FocusEvent>;
|
|
628
|
+
onBlurCapture?: DOMHandler<C, React$1.FocusEvent>;
|
|
629
|
+
onCanPlay?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
630
|
+
onCanPlayCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
631
|
+
onCanPlayThrough?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
632
|
+
onCanPlayThroughCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
633
|
+
onClick?: DOMHandler<C, React$1.MouseEvent>;
|
|
634
|
+
onClickCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
635
|
+
onCompositionEnd?: DOMHandler<C, React$1.CompositionEvent>;
|
|
636
|
+
onCompositionEndCapture?: DOMHandler<C, React$1.CompositionEvent>;
|
|
637
|
+
onCompositionStart?: DOMHandler<C, React$1.CompositionEvent>;
|
|
638
|
+
onCompositionStartCapture?: DOMHandler<C, React$1.CompositionEvent>;
|
|
639
|
+
onCompositionUpdate?: DOMHandler<C, React$1.CompositionEvent>;
|
|
640
|
+
onCompositionUpdateCapture?: DOMHandler<C, React$1.CompositionEvent>;
|
|
641
|
+
onContextMenu?: DOMHandler<C, React$1.MouseEvent>;
|
|
642
|
+
onContextMenuCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
643
|
+
onCopy?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
644
|
+
onCopyCapture?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
645
|
+
onCut?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
646
|
+
onCutCapture?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
647
|
+
onDOMBeforeInput?: DOMHandler<C, Event>;
|
|
648
|
+
onDoubleClick?: DOMHandler<C, React$1.MouseEvent>;
|
|
649
|
+
onDoubleClickCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
650
|
+
onDrag?: DOMHandler<C, React$1.DragEvent>;
|
|
651
|
+
onDragCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
652
|
+
onDragEnd?: DOMHandler<C, React$1.DragEvent>;
|
|
653
|
+
onDragEndCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
654
|
+
onDragEnter?: DOMHandler<C, React$1.DragEvent>;
|
|
655
|
+
onDragEnterCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
656
|
+
onDragExit?: DOMHandler<C, React$1.DragEvent>;
|
|
657
|
+
onDragExitCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
658
|
+
onDragLeave?: DOMHandler<C, React$1.DragEvent>;
|
|
659
|
+
onDragLeaveCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
660
|
+
onDragOver?: DOMHandler<C, React$1.DragEvent>;
|
|
661
|
+
onDragOverCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
662
|
+
onDragStart?: DOMHandler<C, React$1.DragEvent>;
|
|
663
|
+
onDragStartCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
664
|
+
onDrop?: DOMHandler<C, React$1.DragEvent>;
|
|
665
|
+
onDropCapture?: DOMHandler<C, React$1.DragEvent>;
|
|
666
|
+
onDurationChange?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
667
|
+
onDurationChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
668
|
+
onEmptied?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
669
|
+
onEmptiedCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
670
|
+
onEncrypted?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
671
|
+
onEncryptedCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
672
|
+
onEnded?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
673
|
+
onEndedCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
674
|
+
onFocus?: DOMHandler<C, React$1.FocusEvent>;
|
|
675
|
+
onFocusCapture?: DOMHandler<C, React$1.FocusEvent>;
|
|
676
|
+
onGotPointerCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
677
|
+
onGotPointerCaptureCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
678
|
+
onInput?: DOMHandler<C, React$1.FormEvent>;
|
|
679
|
+
onInputCapture?: DOMHandler<C, React$1.FormEvent>;
|
|
680
|
+
onInvalid?: DOMHandler<C, React$1.FormEvent>;
|
|
681
|
+
onInvalidCapture?: DOMHandler<C, React$1.FormEvent>;
|
|
682
|
+
onKeyDown?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
683
|
+
onKeyDownCapture?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
684
|
+
onKeyPress?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
685
|
+
onKeyPressCapture?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
686
|
+
onKeyUp?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
687
|
+
onKeyUpCapture?: DOMHandler<C, React$1.KeyboardEvent>;
|
|
688
|
+
onLoad?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
689
|
+
onLoadCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
690
|
+
onLoadedData?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
691
|
+
onLoadedDataCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
692
|
+
onLoadedMetadata?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
693
|
+
onLoadedMetadataCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
694
|
+
onLoadStart?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
695
|
+
onLoadStartCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
696
|
+
onLostPointerCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
697
|
+
onLostPointerCaptureCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
698
|
+
onMouseDown?: DOMHandler<C, React$1.MouseEvent>;
|
|
699
|
+
onMouseDownCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
700
|
+
onMouseEnter?: DOMHandler<C, React$1.MouseEvent>;
|
|
701
|
+
onMouseLeave?: DOMHandler<C, React$1.MouseEvent>;
|
|
702
|
+
onMouseMove?: DOMHandler<C, React$1.MouseEvent>;
|
|
703
|
+
onMouseMoveCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
704
|
+
onMouseOut?: DOMHandler<C, React$1.MouseEvent>;
|
|
705
|
+
onMouseOutCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
706
|
+
onMouseOver?: DOMHandler<C, React$1.MouseEvent>;
|
|
707
|
+
onMouseOverCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
708
|
+
onMouseUp?: DOMHandler<C, React$1.MouseEvent>;
|
|
709
|
+
onMouseUpCapture?: DOMHandler<C, React$1.MouseEvent>;
|
|
710
|
+
onPaste?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
711
|
+
onPasteCapture?: DOMHandler<C, React$1.ClipboardEvent>;
|
|
712
|
+
onPause?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
713
|
+
onPauseCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
714
|
+
onPlay?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
715
|
+
onPlayCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
716
|
+
onPlaying?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
717
|
+
onPlayingCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
718
|
+
onPointerCancel?: DOMHandler<C, React$1.PointerEvent>;
|
|
719
|
+
onPointerCancelCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
720
|
+
onPointerDown?: DOMHandler<C, React$1.PointerEvent>;
|
|
721
|
+
onPointerDownCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
722
|
+
onPointerEnter?: DOMHandler<C, React$1.PointerEvent>;
|
|
723
|
+
onPointerLeave?: DOMHandler<C, React$1.PointerEvent>;
|
|
724
|
+
onPointerMove?: DOMHandler<C, React$1.PointerEvent>;
|
|
725
|
+
onPointerMoveCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
726
|
+
onPointerOut?: DOMHandler<C, React$1.PointerEvent>;
|
|
727
|
+
onPointerOutCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
728
|
+
onPointerOver?: DOMHandler<C, React$1.PointerEvent>;
|
|
729
|
+
onPointerOverCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
730
|
+
onPointerUp?: DOMHandler<C, React$1.PointerEvent>;
|
|
731
|
+
onPointerUpCapture?: DOMHandler<C, React$1.PointerEvent>;
|
|
732
|
+
onProgress?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
733
|
+
onProgressCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
734
|
+
onRateChange?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
735
|
+
onRateChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
736
|
+
onReset?: DOMHandler<C, React$1.FormEvent>;
|
|
737
|
+
onResetCapture?: DOMHandler<C, React$1.FormEvent>;
|
|
738
|
+
onScroll?: DOMHandler<C, React$1.UIEvent>;
|
|
739
|
+
onScrollCapture?: DOMHandler<C, React$1.UIEvent>;
|
|
740
|
+
onSeeked?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
741
|
+
onSeekedCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
742
|
+
onSeeking?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
743
|
+
onSeekingCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
744
|
+
onSelect?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
745
|
+
onSelectCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
746
|
+
onStalled?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
747
|
+
onStalledCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
748
|
+
onSubmit?: DOMHandler<C, React$1.FormEvent>;
|
|
749
|
+
onSubmitCapture?: DOMHandler<C, React$1.FormEvent>;
|
|
750
|
+
onSuspend?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
751
|
+
onSuspendCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
752
|
+
onTimeUpdate?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
753
|
+
onTimeUpdateCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
754
|
+
onTouchCancel?: DOMHandler<C, React$1.TouchEvent>;
|
|
755
|
+
onTouchCancelCapture?: DOMHandler<C, React$1.TouchEvent>;
|
|
756
|
+
onTouchEnd?: DOMHandler<C, React$1.TouchEvent>;
|
|
757
|
+
onTouchEndCapture?: DOMHandler<C, React$1.TouchEvent>;
|
|
758
|
+
onTouchMove?: DOMHandler<C, React$1.TouchEvent>;
|
|
759
|
+
onTouchMoveCapture?: DOMHandler<C, React$1.TouchEvent>;
|
|
760
|
+
onTouchStart?: DOMHandler<C, React$1.TouchEvent>;
|
|
761
|
+
onTouchStartCapture?: DOMHandler<C, React$1.TouchEvent>;
|
|
762
|
+
onTransitionEnd?: DOMHandler<C, React$1.TransitionEvent>;
|
|
763
|
+
onTransitionEndCapture?: DOMHandler<C, React$1.TransitionEvent>;
|
|
764
|
+
onVolumeChange?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
765
|
+
onVolumeChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
766
|
+
onWaiting?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
767
|
+
onWaitingCapture?: DOMHandler<C, React$1.SyntheticEvent>;
|
|
768
|
+
onWheel?: DOMHandler<C, React$1.WheelEvent>;
|
|
769
|
+
onWheelCapture?: DOMHandler<C, React$1.WheelEvent>;
|
|
770
|
+
};
|
|
771
|
+
//#endregion
|
|
772
|
+
//#region src/react/plugin/KeyboardHandler.d.ts
|
|
773
|
+
type KeyboardHandler<C extends AnyPluginConfig = PluginConfig> = DOMHandler<C, React$1.KeyboardEvent>;
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/react/plugin/createPlatePlugin.d.ts
|
|
776
|
+
type PlatePluginConfig$2<K$1 extends string = any, O = {}, A$1 = {}, T = {}, S = {}> = Omit<Partial<Modify<PlatePlugin<PluginConfig<K$1, O, A$1, T, S>>, {
|
|
777
|
+
node: Partial<PlatePlugin<PluginConfig<K$1, O, A$1, T, S>>['node']>;
|
|
778
|
+
}>>, keyof PlatePluginMethods | 'optionsStore' | 'useOptionsStore'>;
|
|
779
|
+
type TPlatePluginConfig<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<Modify<PlatePlugin<C>, {
|
|
780
|
+
node: Partial<PlatePlugin<C>['node']>;
|
|
781
|
+
}>>, keyof PlatePluginMethods | 'optionsStore' | 'useOptionsStore'>;
|
|
782
|
+
declare const createPlatePlugin: <K$1 extends string = any, O = {}, A$1 = {}, T = {}, S = {}>(config?: ((editor: PlateEditor) => PlatePluginConfig$2<K$1, O, A$1, T, S>) | PlatePluginConfig$2<K$1, O, A$1, T, S>) => PlatePlugin<PluginConfig<K$1, O, A$1, T, S>>;
|
|
783
|
+
/**
|
|
784
|
+
* Explicitly typed version of `createPlatePlugin`.
|
|
785
|
+
*
|
|
786
|
+
* @remarks
|
|
787
|
+
* While `createPlatePlugin` uses type inference, this function requires an
|
|
788
|
+
* explicit type parameter. Use this when you need precise control over the
|
|
789
|
+
* plugin's type structure or when type inference doesn't provide the desired
|
|
790
|
+
* result.
|
|
791
|
+
*/
|
|
792
|
+
declare function createTPlatePlugin<C extends AnyPluginConfig = PluginConfig>(config?: ((editor: PlateEditor) => TPlatePluginConfig<C>) | TPlatePluginConfig<C>): PlatePlugin<C>;
|
|
793
|
+
//#endregion
|
|
794
|
+
//#region src/react/editor/getPlateCorePlugins.d.ts
|
|
795
|
+
declare const getPlateCorePlugins: () => (PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"slateExtension", {
|
|
796
|
+
onNodeChange: (options: {
|
|
797
|
+
editor: SlateEditor;
|
|
798
|
+
node: Descendant$1;
|
|
799
|
+
operation: NodeOperation$1;
|
|
800
|
+
prevNode: Descendant$1;
|
|
801
|
+
}) => void;
|
|
802
|
+
onTextChange: (options: {
|
|
803
|
+
editor: SlateEditor;
|
|
804
|
+
node: Descendant$1;
|
|
805
|
+
operation: TextOperation$1;
|
|
806
|
+
prevText: string;
|
|
807
|
+
text: string;
|
|
808
|
+
}) => void;
|
|
809
|
+
}, {
|
|
810
|
+
redecorate: () => void;
|
|
811
|
+
}, {
|
|
812
|
+
reset: (options: ResetOptions | undefined) => void;
|
|
813
|
+
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
814
|
+
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
815
|
+
resetBlock: ((args_0?: {
|
|
816
|
+
at?: Path$1;
|
|
817
|
+
} | undefined) => true | undefined) & ((args_0?: {
|
|
818
|
+
at?: Path$1;
|
|
819
|
+
} | undefined) => true | undefined);
|
|
820
|
+
setValue: ((value?: string | Value$1 | undefined) => void) & ((value?: string | Value$1 | undefined) => void);
|
|
821
|
+
apply: <N$1 extends TElement$1 | TText$1>(operation: Operation$1<N$1>) => void;
|
|
822
|
+
}, {}>> | PlatePlugin<PluginConfig<"dom", {
|
|
823
|
+
scrollMode?: ScrollMode;
|
|
824
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
825
|
+
scrollOptions?: ScrollIntoViewOptions$1;
|
|
826
|
+
}, {
|
|
827
|
+
isScrolling: () => boolean;
|
|
828
|
+
}, {
|
|
829
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
830
|
+
}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>)[];
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/react/editor/usePlateEditor.d.ts
|
|
833
|
+
/**
|
|
834
|
+
* Creates a memoized Plate editor for React components.
|
|
835
|
+
*
|
|
836
|
+
* This hook creates a fully configured Plate editor instance that is memoized
|
|
837
|
+
* based on the provided dependencies. It's optimized for React components to
|
|
838
|
+
* prevent unnecessary re-creation of the editor on every render.
|
|
839
|
+
*
|
|
840
|
+
* Examples:
|
|
841
|
+
*
|
|
842
|
+
* ```ts
|
|
843
|
+
* const editor = usePlateEditor({
|
|
844
|
+
* plugins: [ParagraphPlugin, HeadingPlugin],
|
|
845
|
+
* value: [{ type: 'p', children: [{ text: 'Hello world!' }] }],
|
|
846
|
+
* });
|
|
847
|
+
*
|
|
848
|
+
* // Editor with custom dependencies
|
|
849
|
+
* const editor = usePlateEditor(
|
|
850
|
+
* {
|
|
851
|
+
* plugins: [ParagraphPlugin],
|
|
852
|
+
* enabled,
|
|
853
|
+
* },
|
|
854
|
+
* [enabled]
|
|
855
|
+
* ); // Re-create when enabled changes
|
|
856
|
+
* ```
|
|
857
|
+
*
|
|
858
|
+
* @param options - Configuration options for creating the Plate editor
|
|
859
|
+
* @param deps - Additional dependencies for the useMemo hook (default: [])
|
|
860
|
+
* @see {@link createPlateEditor} for detailed information on React editor creation and configuration.
|
|
861
|
+
* @see {@link createSlateEditor} for a non-React version of editor creation.
|
|
862
|
+
* @see {@link withPlate} for the underlying React-specific enhancement function.
|
|
863
|
+
*/
|
|
864
|
+
declare function usePlateEditor<V$1 extends Value = Value, P$1 extends AnyPluginConfig = PlateCorePlugin, TEnabled extends boolean | undefined = undefined>(options?: CreatePlateEditorOptions<V$1, P$1> & {
|
|
865
|
+
enabled?: TEnabled;
|
|
866
|
+
}, deps?: React$1.DependencyList): TEnabled extends false ? null : TEnabled extends true | undefined ? TPlateEditor<V$1, P$1> : TPlateEditor<V$1, P$1> | null;
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region src/react/editor/usePlateViewEditor.d.ts
|
|
869
|
+
/**
|
|
870
|
+
* Creates a memoized static Plate editor for view-only React components.
|
|
871
|
+
*
|
|
872
|
+
* This hook creates a fully configured static Plate editor instance that is
|
|
873
|
+
* memoized based on the provided dependencies. It's optimized for React
|
|
874
|
+
* components to prevent unnecessary re-creation of the editor on every render.
|
|
875
|
+
* Uses createStaticEditor.
|
|
876
|
+
*
|
|
877
|
+
* @param options - Configuration options for creating the static Plate editor
|
|
878
|
+
* @param deps - Additional dependencies for the useMemo hook (default: [])
|
|
879
|
+
* @see {@link createStaticEditor} for detailed information on static editor creation and configuration.
|
|
880
|
+
*/
|
|
881
|
+
declare function usePlateViewEditor<V$1 extends Value = Value, P$1 extends AnyPluginConfig = any, TEnabled extends boolean | undefined = undefined>(options?: Parameters<typeof createStaticEditor<V$1, P$1>>[0] & {
|
|
882
|
+
enabled?: TEnabled;
|
|
883
|
+
}, deps?: React$1.DependencyList): TEnabled extends false ? null : TEnabled extends true | undefined ? ReturnType<typeof createStaticEditor<V$1, P$1>> : ReturnType<typeof createStaticEditor<V$1, P$1>> | null;
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/react/plugin/getEditorPlugin.d.ts
|
|
886
|
+
declare function getEditorPlugin<P$1 extends AnyPluginConfig | PlatePlugin<AnyPluginConfig>>(editor: PlateEditor, plugin: WithRequiredKey<P$1>): PlatePluginContext<InferConfig<P$1> extends never ? P$1 : InferConfig<P$1>>;
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/react/plugin/getPlugin.d.ts
|
|
889
|
+
/** Get editor plugin by key or plugin object. */
|
|
890
|
+
declare function getPlugin<C extends AnyPluginConfig = PluginConfig>(editor: PlateEditor, plugin: WithRequiredKey<C>): C extends {
|
|
891
|
+
node: any;
|
|
892
|
+
} ? C : PlatePlugin<C>;
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/react/plugin/omitPluginContext.d.ts
|
|
895
|
+
declare const omitPluginContext: <T extends PlatePluginContext<AnyPlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "getOptions" | "getOption" | "tf" | "type" | "setOptions" | "setOption" | "plugin">;
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/react/plugin/toPlatePlugin.d.ts
|
|
898
|
+
type PlatePluginConfig$1<C extends AnyPluginConfig, EO = {}, EA = {}, ET = {}, ES = {}> = Omit<Partial<PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>>, keyof PlatePluginMethods | 'api' | 'node' | 'options' | 'transforms'> & {
|
|
899
|
+
api?: EA & Partial<InferApi<C>>;
|
|
900
|
+
node?: Partial<PlatePlugin<C>['node']>;
|
|
901
|
+
options?: EO & Partial<InferOptions<C>>;
|
|
902
|
+
selectors?: ES & Partial<InferSelectors<C>>;
|
|
903
|
+
transforms?: ET & Partial<InferTransforms<C>>;
|
|
904
|
+
};
|
|
905
|
+
/**
|
|
906
|
+
* Extends a SlatePlugin to create a React PlatePlugin.
|
|
907
|
+
*
|
|
908
|
+
* @remarks
|
|
909
|
+
* This function transforms a SlatePlugin into a React PlatePlugin, allowing for
|
|
910
|
+
* React-specific functionality to be added.
|
|
911
|
+
* @param basePlugin - The base SlatePlugin to be extended.
|
|
912
|
+
* @param extendConfig - A function or object that provides the extension
|
|
913
|
+
* configuration. If a function, it receives the plugin context and should
|
|
914
|
+
* return a partial PlatePlugin. If an object, it should be a partial
|
|
915
|
+
* PlatePlugin configuration.
|
|
916
|
+
* @returns A new PlatePlugin that combines the base SlatePlugin functionality
|
|
917
|
+
* with React-specific features defined in the extension configuration.
|
|
918
|
+
*/
|
|
919
|
+
declare function toPlatePlugin<C extends AnyPluginConfig, EO = {}, EA = {}, ET = {}, ES = {}>(basePlugin: SlatePlugin<C>, extendConfig?: ((ctx: PlatePluginContext<C>) => PlatePluginConfig$1<C, EO, EA, ET>) | PlatePluginConfig$1<C, EO, EA, ET>): PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>;
|
|
920
|
+
type ExtendPluginConfig<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<PlatePlugin<PluginConfig<C['key'], Partial<InferOptions<C>>, Partial<InferApi<C>>, Partial<InferTransforms<C>>>>>, keyof PlatePluginMethods>;
|
|
921
|
+
/**
|
|
922
|
+
* Explicitly typed version of {@link toPlatePlugin}.
|
|
923
|
+
*
|
|
924
|
+
* @remarks
|
|
925
|
+
* This function requires explicit type parameters for both the base plugin
|
|
926
|
+
* configuration and the extension configuration. Use this when you need
|
|
927
|
+
* precise control over the plugin's type structure or when type inference
|
|
928
|
+
* doesn't provide the desired result.
|
|
929
|
+
* @typeParam C - The type of the extension configuration for the PlatePlugin
|
|
930
|
+
* (required).
|
|
931
|
+
* @typeParam TContext - The type of the base SlatePlugin configuration
|
|
932
|
+
* (optional).
|
|
933
|
+
*/
|
|
934
|
+
declare function toTPlatePlugin<C extends AnyPluginConfig = PluginConfig, TContext extends AnyPluginConfig = AnyPluginConfig>(basePlugin: SlatePlugin<TContext>, extendConfig?: ((ctx: PlatePluginContext<TContext>) => ExtendPluginConfig<C>) | ExtendPluginConfig<C>): PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>>;
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region src/react/components/plate-nodes.d.ts
|
|
937
|
+
declare const useNodeAttributes: (props: any, ref?: any) => any;
|
|
938
|
+
type PlateChunkProps = RenderChunkProps;
|
|
939
|
+
type PlateElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig> = PlateNodeProps<C> & RenderElementProps<N$1> & {
|
|
940
|
+
attributes: UnknownObject;
|
|
941
|
+
path: Path;
|
|
942
|
+
} & DeprecatedNodeProps;
|
|
943
|
+
type DeprecatedNodeProps = {
|
|
944
|
+
/**
|
|
945
|
+
* @deprecated Optional class to be merged with `attributes.className`.
|
|
946
|
+
* @default undefined
|
|
947
|
+
*/
|
|
948
|
+
className?: string;
|
|
949
|
+
/**
|
|
950
|
+
* @deprecated Optional style to be merged with `attributes.style`
|
|
951
|
+
* @default undefined
|
|
952
|
+
*/
|
|
953
|
+
style?: React$1.CSSProperties;
|
|
954
|
+
};
|
|
955
|
+
type PlateNodeProps<C extends AnyPluginConfig = PluginConfig> = PlatePluginContext<C> & {
|
|
956
|
+
/**
|
|
957
|
+
* Optional ref to be merged with `attributes.ref`
|
|
958
|
+
*
|
|
959
|
+
* @default undefined
|
|
960
|
+
*/
|
|
961
|
+
ref?: any;
|
|
962
|
+
};
|
|
963
|
+
type PlateHTMLProps<C extends AnyPluginConfig = PluginConfig, T extends React$1.ComponentType<PlateElementProps> | keyof HTMLElementTagNameMap = 'div'> = PlateNodeProps<C> & {
|
|
964
|
+
/** HTML attributes to pass to the underlying HTML element */
|
|
965
|
+
attributes: React$1.PropsWithoutRef<T extends React$1.ComponentType<PlateElementProps> ? React$1.ComponentProps<T> : T extends keyof HTMLElementTagNameMap ? React$1.JSX.IntrinsicElements[T] : never>;
|
|
966
|
+
as?: T;
|
|
967
|
+
/** Class to be merged with `attributes.className` */
|
|
968
|
+
className?: string;
|
|
969
|
+
/** Style to be merged with `attributes.style` */
|
|
970
|
+
style?: React$1.CSSProperties;
|
|
971
|
+
};
|
|
972
|
+
type StyledPlateElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'div'> = Omit<PlateElementProps<N$1, C>, keyof DeprecatedNodeProps> & PlateHTMLProps<C, T> & {
|
|
973
|
+
insetProp?: boolean;
|
|
974
|
+
};
|
|
975
|
+
declare const PlateElement: <N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "div">(props: StyledPlateElementProps<N$1, C, T>) => React$1.ReactElement;
|
|
976
|
+
type PlateTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = PlateNodeProps<C> & RenderTextProps<N$1> & DeprecatedNodeProps & {
|
|
977
|
+
attributes: UnknownObject;
|
|
978
|
+
};
|
|
979
|
+
type StyledPlateTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'span'> = Omit<PlateTextProps<N$1, C>, keyof DeprecatedNodeProps> & PlateHTMLProps<C, T>;
|
|
980
|
+
declare const PlateText: <N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "span">(props: StyledPlateTextProps<N$1, C, T>) => React$1.ReactElement;
|
|
981
|
+
type PlateLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = PlateNodeProps<C> & RenderLeafProps<N$1> & DeprecatedNodeProps & {
|
|
982
|
+
attributes: UnknownObject;
|
|
983
|
+
inset?: boolean;
|
|
984
|
+
};
|
|
985
|
+
type StyledPlateLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'span'> = Omit<PlateLeafProps<N$1, C>, keyof DeprecatedNodeProps> & PlateHTMLProps<C, T>;
|
|
986
|
+
declare const PlateLeaf: <N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "span">({
|
|
987
|
+
className,
|
|
988
|
+
...props
|
|
989
|
+
}: StyledPlateLeafProps<N$1, C, T>) => React$1.ReactElement;
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region src/react/components/ContentVisibilityChunk.d.ts
|
|
992
|
+
declare const ContentVisibilityChunk: ({
|
|
993
|
+
attributes,
|
|
994
|
+
children,
|
|
995
|
+
lowest
|
|
996
|
+
}: PlateChunkProps) => any;
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region src/react/components/EditorHotkeysEffect.d.ts
|
|
999
|
+
declare function EditorHotkeysEffect({
|
|
1000
|
+
id,
|
|
1001
|
+
editableRef
|
|
1002
|
+
}: {
|
|
1003
|
+
editableRef: React$1.RefObject<HTMLDivElement | null>;
|
|
1004
|
+
id?: string;
|
|
1005
|
+
}): React$1.JSX.Element;
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region src/react/components/EditorMethodsEffect.d.ts
|
|
1008
|
+
declare const EditorMethodsEffect: ({
|
|
1009
|
+
id
|
|
1010
|
+
}: {
|
|
1011
|
+
id?: string;
|
|
1012
|
+
}) => null;
|
|
1013
|
+
//#endregion
|
|
1014
|
+
//#region src/react/components/EditorRefEffect.d.ts
|
|
1015
|
+
declare function EditorRefPluginEffect({
|
|
1016
|
+
id,
|
|
1017
|
+
plugin
|
|
1018
|
+
}: {
|
|
1019
|
+
plugin: AnyEditorPlatePlugin;
|
|
1020
|
+
id?: string;
|
|
1021
|
+
}): null;
|
|
1022
|
+
declare function EditorRefEffect({
|
|
1023
|
+
id
|
|
1024
|
+
}: {
|
|
1025
|
+
id?: string;
|
|
1026
|
+
}): React$1.JSX.Element;
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region src/react/stores/element/useElement.d.ts
|
|
1029
|
+
/**
|
|
1030
|
+
* Get the element by plugin key. If no element is found in the context, it will
|
|
1031
|
+
* return an empty object.
|
|
1032
|
+
*/
|
|
1033
|
+
declare const useElement: <T extends TElement = TElement>(pluginKey?: string) => T;
|
|
1034
|
+
//#endregion
|
|
1035
|
+
//#region src/react/stores/element/useElementSelector.d.ts
|
|
1036
|
+
type UseElementSelectorOptions<T> = {
|
|
1037
|
+
key?: string;
|
|
1038
|
+
equalityFn?: (a: T, b: T) => boolean;
|
|
1039
|
+
};
|
|
1040
|
+
declare const useElementSelector: <T>(selector: <N$1 extends TElement>(state: NodeEntry<N$1>, prev?: T) => T, deps: React$1.DependencyList, {
|
|
1041
|
+
key,
|
|
1042
|
+
equalityFn
|
|
1043
|
+
}?: UseElementSelectorOptions<T>) => T;
|
|
1044
|
+
//#endregion
|
|
1045
|
+
//#region src/react/stores/element/useElementStore.d.ts
|
|
1046
|
+
declare const SCOPE_ELEMENT = "element";
|
|
1047
|
+
type ElementStoreState = {
|
|
1048
|
+
element: TElement;
|
|
1049
|
+
entry: ElementEntry;
|
|
1050
|
+
path: Path;
|
|
1051
|
+
};
|
|
1052
|
+
declare const ElementProvider: React$1.FC<jotai_x98.ProviderProps<{
|
|
1053
|
+
element: TElement;
|
|
1054
|
+
entry: ElementEntry;
|
|
1055
|
+
path: Path;
|
|
1056
|
+
}>>, elementStore: jotai_x98.StoreApi<ElementStoreState, object, "element">, useElementStore: jotai_x98.UseStoreApi<ElementStoreState, object>;
|
|
1057
|
+
//#endregion
|
|
1058
|
+
//#region src/react/stores/element/usePath.d.ts
|
|
1059
|
+
/** Get the memoized path of the closest element. */
|
|
1060
|
+
declare const usePath: (pluginKey?: string) => Path;
|
|
1061
|
+
//#endregion
|
|
1062
|
+
//#region src/react/stores/event-editor/useEventPlateId.d.ts
|
|
1063
|
+
/** Get last event editor id: focus, blur or last. */
|
|
1064
|
+
declare const useEventPlateId: (id?: string) => string;
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/react/stores/plate/PlateStore.d.ts
|
|
1067
|
+
type PlateChangeKey = 'versionDecorate' | 'versionEditor' | 'versionSelection' | 'versionValue';
|
|
1068
|
+
type PlateStoreState<E extends PlateEditor = PlateEditor> = Nullable<{
|
|
1069
|
+
composing: boolean;
|
|
1070
|
+
decorate: NonNullable<(options: {
|
|
1071
|
+
editor: E;
|
|
1072
|
+
entry: NodeEntry;
|
|
1073
|
+
}) => TRange[]>;
|
|
1074
|
+
/** Whether `Editable` is rendered so slate DOM is resolvable. */
|
|
1075
|
+
isMounted: boolean;
|
|
1076
|
+
/**
|
|
1077
|
+
* Whether the editor is primary. If no editor is active, then PlateController
|
|
1078
|
+
* will use the first-mounted primary editor.
|
|
1079
|
+
*
|
|
1080
|
+
* @default true
|
|
1081
|
+
*/
|
|
1082
|
+
primary: boolean;
|
|
1083
|
+
readOnly: boolean;
|
|
1084
|
+
renderChunk: NonNullable<EditableProps['renderChunk']>;
|
|
1085
|
+
renderElement: NonNullable<EditableProps['renderElement']>;
|
|
1086
|
+
renderLeaf: NonNullable<EditableProps['renderLeaf']>;
|
|
1087
|
+
renderText: NonNullable<EditableProps['renderText']>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Version incremented when calling `redecorate`. This is a dependency of the
|
|
1090
|
+
* `decorate` function.
|
|
1091
|
+
*/
|
|
1092
|
+
versionDecorate: number;
|
|
1093
|
+
/** Version incremented on each editor change. */
|
|
1094
|
+
versionEditor: number;
|
|
1095
|
+
/** Version incremented on each editor.selection change. */
|
|
1096
|
+
versionSelection: number;
|
|
1097
|
+
/** Version incremented on each editor.children change. */
|
|
1098
|
+
versionValue: number;
|
|
1099
|
+
/** Controlled callback called when the editor state changes. */
|
|
1100
|
+
onChange: (options: {
|
|
1101
|
+
editor: E;
|
|
1102
|
+
value: ValueOf<E>;
|
|
1103
|
+
}) => void;
|
|
1104
|
+
/** Controlled callback called when a node operation is applied. */
|
|
1105
|
+
onNodeChange: (options: {
|
|
1106
|
+
editor: E;
|
|
1107
|
+
node: Descendant;
|
|
1108
|
+
operation: NodeOperation;
|
|
1109
|
+
prevNode: Descendant;
|
|
1110
|
+
}) => void;
|
|
1111
|
+
/** Controlled callback called when the editor.selection changes. */
|
|
1112
|
+
onSelectionChange: (options: {
|
|
1113
|
+
editor: E;
|
|
1114
|
+
selection: TSelection;
|
|
1115
|
+
}) => void;
|
|
1116
|
+
/** Controlled callback called when a text operation is applied. */
|
|
1117
|
+
onTextChange: (options: {
|
|
1118
|
+
editor: E;
|
|
1119
|
+
node: Descendant;
|
|
1120
|
+
operation: TextOperation;
|
|
1121
|
+
prevText: string;
|
|
1122
|
+
text: string;
|
|
1123
|
+
}) => void;
|
|
1124
|
+
/** Controlled callback called when the editor.children changes. */
|
|
1125
|
+
onValueChange: (options: {
|
|
1126
|
+
editor: E;
|
|
1127
|
+
value: ValueOf<E>;
|
|
1128
|
+
}) => void;
|
|
1129
|
+
}> & {
|
|
1130
|
+
/**
|
|
1131
|
+
* A unique id used as a provider scope. Use it if you have multiple `Plate`
|
|
1132
|
+
* in the same React tree.
|
|
1133
|
+
*
|
|
1134
|
+
* @default random id
|
|
1135
|
+
*/
|
|
1136
|
+
id: string;
|
|
1137
|
+
/** A reference to the editor container element. */
|
|
1138
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Slate editor reference.
|
|
1141
|
+
*
|
|
1142
|
+
* @default createPlateFallbackEditor()
|
|
1143
|
+
*/
|
|
1144
|
+
editor: E;
|
|
1145
|
+
/**
|
|
1146
|
+
* A reference to the editor scroll container element.
|
|
1147
|
+
*
|
|
1148
|
+
* @default containerRef
|
|
1149
|
+
*/
|
|
1150
|
+
scrollRef: React.RefObject<HTMLDivElement | null>;
|
|
1151
|
+
};
|
|
1152
|
+
//#endregion
|
|
1153
|
+
//#region src/react/stores/plate/createPlateStore.d.ts
|
|
1154
|
+
type PlateStore = ReturnType<typeof usePlateStore>;
|
|
1155
|
+
declare const PLATE_SCOPE = "plate";
|
|
1156
|
+
declare const GLOBAL_PLATE_SCOPE: unique symbol;
|
|
1157
|
+
declare const createPlateStore: <E extends PlateEditor = PlateEditor>({
|
|
1158
|
+
id,
|
|
1159
|
+
composing,
|
|
1160
|
+
containerRef,
|
|
1161
|
+
decorate,
|
|
1162
|
+
editor,
|
|
1163
|
+
isMounted,
|
|
1164
|
+
primary,
|
|
1165
|
+
readOnly,
|
|
1166
|
+
renderChunk,
|
|
1167
|
+
renderElement,
|
|
1168
|
+
renderLeaf,
|
|
1169
|
+
renderText,
|
|
1170
|
+
scrollRef,
|
|
1171
|
+
versionDecorate,
|
|
1172
|
+
versionEditor,
|
|
1173
|
+
versionSelection,
|
|
1174
|
+
versionValue,
|
|
1175
|
+
onChange,
|
|
1176
|
+
onNodeChange,
|
|
1177
|
+
onSelectionChange,
|
|
1178
|
+
onTextChange,
|
|
1179
|
+
onValueChange,
|
|
1180
|
+
...state
|
|
1181
|
+
}?: Partial<PlateStoreState<E>>) => jotai_x98.AtomStoreApi<PlateStoreState<E>, {
|
|
1182
|
+
trackedEditor: jotai10.Atom<{
|
|
1183
|
+
editor: any;
|
|
1184
|
+
version: number | null;
|
|
1185
|
+
}>;
|
|
1186
|
+
trackedSelection: jotai10.Atom<{
|
|
1187
|
+
selection: any;
|
|
1188
|
+
version: number | null;
|
|
1189
|
+
}>;
|
|
1190
|
+
trackedValue: jotai10.Atom<{
|
|
1191
|
+
value: any;
|
|
1192
|
+
version: number | null;
|
|
1193
|
+
}>;
|
|
1194
|
+
}, "plate">;
|
|
1195
|
+
declare const PlateStoreProvider: React$1.FC<jotai_x98.ProviderProps<{
|
|
1196
|
+
composing: boolean | null;
|
|
1197
|
+
decorate: ((options: {
|
|
1198
|
+
editor: PlateEditor;
|
|
1199
|
+
entry: NodeEntry$1;
|
|
1200
|
+
}) => TRange$1[]) | null;
|
|
1201
|
+
isMounted: boolean | null;
|
|
1202
|
+
primary: boolean | null;
|
|
1203
|
+
readOnly: boolean | null;
|
|
1204
|
+
renderChunk: RenderChunkFn | null;
|
|
1205
|
+
renderElement: RenderElementFn | null;
|
|
1206
|
+
renderLeaf: RenderLeafFn | null;
|
|
1207
|
+
renderText: RenderTextFn | null;
|
|
1208
|
+
versionDecorate: number | null;
|
|
1209
|
+
versionEditor: number | null;
|
|
1210
|
+
versionSelection: number | null;
|
|
1211
|
+
versionValue: number | null;
|
|
1212
|
+
onChange: ((options: {
|
|
1213
|
+
editor: PlateEditor;
|
|
1214
|
+
value: Value$1;
|
|
1215
|
+
}) => void) | null;
|
|
1216
|
+
onNodeChange: ((options: {
|
|
1217
|
+
editor: PlateEditor;
|
|
1218
|
+
node: Descendant$1;
|
|
1219
|
+
operation: NodeOperation$1;
|
|
1220
|
+
prevNode: Descendant$1;
|
|
1221
|
+
}) => void) | null;
|
|
1222
|
+
onSelectionChange: ((options: {
|
|
1223
|
+
editor: PlateEditor;
|
|
1224
|
+
selection: TSelection$1;
|
|
1225
|
+
}) => void) | null;
|
|
1226
|
+
onTextChange: ((options: {
|
|
1227
|
+
editor: PlateEditor;
|
|
1228
|
+
node: Descendant$1;
|
|
1229
|
+
operation: TextOperation$1;
|
|
1230
|
+
prevText: string;
|
|
1231
|
+
text: string;
|
|
1232
|
+
}) => void) | null;
|
|
1233
|
+
onValueChange: ((options: {
|
|
1234
|
+
editor: PlateEditor;
|
|
1235
|
+
value: Value$1;
|
|
1236
|
+
}) => void) | null;
|
|
1237
|
+
id: string;
|
|
1238
|
+
containerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
1239
|
+
editor: PlateEditor;
|
|
1240
|
+
scrollRef: React$1.RefObject<HTMLDivElement | null>;
|
|
1241
|
+
}>>, plateStore: jotai_x98.StoreApi<PlateStoreState<PlateEditor>, {
|
|
1242
|
+
trackedEditor: jotai10.Atom<{
|
|
1243
|
+
editor: any;
|
|
1244
|
+
version: number | null;
|
|
1245
|
+
}>;
|
|
1246
|
+
trackedSelection: jotai10.Atom<{
|
|
1247
|
+
selection: any;
|
|
1248
|
+
version: number | null;
|
|
1249
|
+
}>;
|
|
1250
|
+
trackedValue: jotai10.Atom<{
|
|
1251
|
+
value: any;
|
|
1252
|
+
version: number | null;
|
|
1253
|
+
}>;
|
|
1254
|
+
}, "plate">, usePlateLocalSet: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "editor" | "id" | "onChange" | "renderText" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onNodeChange" | "onSelectionChange" | "onTextChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | jotai_x98.UseAtomOptions) => ({
|
|
1255
|
+
composing: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1256
|
+
decorate: jotai_x98.SimpleWritableAtom<((options: {
|
|
1257
|
+
editor: PlateEditor;
|
|
1258
|
+
entry: NodeEntry$1;
|
|
1259
|
+
}) => TRange$1[]) | null>;
|
|
1260
|
+
isMounted: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1261
|
+
primary: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1262
|
+
readOnly: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1263
|
+
renderChunk: jotai_x98.SimpleWritableAtom<RenderChunkFn | null>;
|
|
1264
|
+
renderElement: jotai_x98.SimpleWritableAtom<RenderElementFn | null>;
|
|
1265
|
+
renderLeaf: jotai_x98.SimpleWritableAtom<RenderLeafFn | null>;
|
|
1266
|
+
renderText: jotai_x98.SimpleWritableAtom<RenderTextFn | null>;
|
|
1267
|
+
versionDecorate: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1268
|
+
versionEditor: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1269
|
+
versionSelection: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1270
|
+
versionValue: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1271
|
+
onChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1272
|
+
editor: PlateEditor;
|
|
1273
|
+
value: Value$1;
|
|
1274
|
+
}) => void) | null>;
|
|
1275
|
+
onNodeChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1276
|
+
editor: PlateEditor;
|
|
1277
|
+
node: Descendant$1;
|
|
1278
|
+
operation: NodeOperation$1;
|
|
1279
|
+
prevNode: Descendant$1;
|
|
1280
|
+
}) => void) | null>;
|
|
1281
|
+
onSelectionChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1282
|
+
editor: PlateEditor;
|
|
1283
|
+
selection: TSelection$1;
|
|
1284
|
+
}) => void) | null>;
|
|
1285
|
+
onTextChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1286
|
+
editor: PlateEditor;
|
|
1287
|
+
node: Descendant$1;
|
|
1288
|
+
operation: TextOperation$1;
|
|
1289
|
+
prevText: string;
|
|
1290
|
+
text: string;
|
|
1291
|
+
}) => void) | null>;
|
|
1292
|
+
onValueChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1293
|
+
editor: PlateEditor;
|
|
1294
|
+
value: Value$1;
|
|
1295
|
+
}) => void) | null>;
|
|
1296
|
+
id: jotai_x98.SimpleWritableAtom<string>;
|
|
1297
|
+
containerRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1298
|
+
editor: jotai_x98.SimpleWritableAtom<PlateEditor>;
|
|
1299
|
+
scrollRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1300
|
+
} & {
|
|
1301
|
+
trackedEditor: jotai10.Atom<{
|
|
1302
|
+
editor: any;
|
|
1303
|
+
version: number | null;
|
|
1304
|
+
}>;
|
|
1305
|
+
trackedSelection: jotai10.Atom<{
|
|
1306
|
+
selection: any;
|
|
1307
|
+
version: number | null;
|
|
1308
|
+
}>;
|
|
1309
|
+
trackedValue: jotai10.Atom<{
|
|
1310
|
+
value: any;
|
|
1311
|
+
version: number | null;
|
|
1312
|
+
}>;
|
|
1313
|
+
})[K$1] extends jotai10.WritableAtom<infer _V, infer A extends unknown[], infer R> ? (...args: A) => R : never, usePlateLocalState: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "editor" | "id" | "onChange" | "renderText" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onNodeChange" | "onSelectionChange" | "onTextChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | jotai_x98.UseAtomOptions) => ({
|
|
1314
|
+
composing: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1315
|
+
decorate: jotai_x98.SimpleWritableAtom<((options: {
|
|
1316
|
+
editor: PlateEditor;
|
|
1317
|
+
entry: NodeEntry$1;
|
|
1318
|
+
}) => TRange$1[]) | null>;
|
|
1319
|
+
isMounted: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1320
|
+
primary: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1321
|
+
readOnly: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1322
|
+
renderChunk: jotai_x98.SimpleWritableAtom<RenderChunkFn | null>;
|
|
1323
|
+
renderElement: jotai_x98.SimpleWritableAtom<RenderElementFn | null>;
|
|
1324
|
+
renderLeaf: jotai_x98.SimpleWritableAtom<RenderLeafFn | null>;
|
|
1325
|
+
renderText: jotai_x98.SimpleWritableAtom<RenderTextFn | null>;
|
|
1326
|
+
versionDecorate: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1327
|
+
versionEditor: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1328
|
+
versionSelection: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1329
|
+
versionValue: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1330
|
+
onChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1331
|
+
editor: PlateEditor;
|
|
1332
|
+
value: Value$1;
|
|
1333
|
+
}) => void) | null>;
|
|
1334
|
+
onNodeChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1335
|
+
editor: PlateEditor;
|
|
1336
|
+
node: Descendant$1;
|
|
1337
|
+
operation: NodeOperation$1;
|
|
1338
|
+
prevNode: Descendant$1;
|
|
1339
|
+
}) => void) | null>;
|
|
1340
|
+
onSelectionChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1341
|
+
editor: PlateEditor;
|
|
1342
|
+
selection: TSelection$1;
|
|
1343
|
+
}) => void) | null>;
|
|
1344
|
+
onTextChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1345
|
+
editor: PlateEditor;
|
|
1346
|
+
node: Descendant$1;
|
|
1347
|
+
operation: TextOperation$1;
|
|
1348
|
+
prevText: string;
|
|
1349
|
+
text: string;
|
|
1350
|
+
}) => void) | null>;
|
|
1351
|
+
onValueChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1352
|
+
editor: PlateEditor;
|
|
1353
|
+
value: Value$1;
|
|
1354
|
+
}) => void) | null>;
|
|
1355
|
+
id: jotai_x98.SimpleWritableAtom<string>;
|
|
1356
|
+
containerRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1357
|
+
editor: jotai_x98.SimpleWritableAtom<PlateEditor>;
|
|
1358
|
+
scrollRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1359
|
+
} & {
|
|
1360
|
+
trackedEditor: jotai10.Atom<{
|
|
1361
|
+
editor: any;
|
|
1362
|
+
version: number | null;
|
|
1363
|
+
}>;
|
|
1364
|
+
trackedSelection: jotai10.Atom<{
|
|
1365
|
+
selection: any;
|
|
1366
|
+
version: number | null;
|
|
1367
|
+
}>;
|
|
1368
|
+
trackedValue: jotai10.Atom<{
|
|
1369
|
+
value: any;
|
|
1370
|
+
version: number | null;
|
|
1371
|
+
}>;
|
|
1372
|
+
})[K$1] extends jotai10.WritableAtom<infer V, infer A extends unknown[], infer R> ? [V, (...args: A) => R] : never, usePlateLocalStore: jotai_x98.UseStoreApi<PlateStoreState<PlateEditor>, {
|
|
1373
|
+
trackedEditor: jotai10.Atom<{
|
|
1374
|
+
editor: any;
|
|
1375
|
+
version: number | null;
|
|
1376
|
+
}>;
|
|
1377
|
+
trackedSelection: jotai10.Atom<{
|
|
1378
|
+
selection: any;
|
|
1379
|
+
version: number | null;
|
|
1380
|
+
}>;
|
|
1381
|
+
trackedValue: jotai10.Atom<{
|
|
1382
|
+
value: any;
|
|
1383
|
+
version: number | null;
|
|
1384
|
+
}>;
|
|
1385
|
+
}>, usePlateLocalValue: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "editor" | "id" | "onChange" | "renderText" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onNodeChange" | "onSelectionChange" | "onTextChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue", S = (({
|
|
1386
|
+
composing: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1387
|
+
decorate: jotai_x98.SimpleWritableAtom<((options: {
|
|
1388
|
+
editor: PlateEditor;
|
|
1389
|
+
entry: NodeEntry$1;
|
|
1390
|
+
}) => TRange$1[]) | null>;
|
|
1391
|
+
isMounted: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1392
|
+
primary: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1393
|
+
readOnly: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1394
|
+
renderChunk: jotai_x98.SimpleWritableAtom<RenderChunkFn | null>;
|
|
1395
|
+
renderElement: jotai_x98.SimpleWritableAtom<RenderElementFn | null>;
|
|
1396
|
+
renderLeaf: jotai_x98.SimpleWritableAtom<RenderLeafFn | null>;
|
|
1397
|
+
renderText: jotai_x98.SimpleWritableAtom<RenderTextFn | null>;
|
|
1398
|
+
versionDecorate: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1399
|
+
versionEditor: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1400
|
+
versionSelection: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1401
|
+
versionValue: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1402
|
+
onChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1403
|
+
editor: PlateEditor;
|
|
1404
|
+
value: Value$1;
|
|
1405
|
+
}) => void) | null>;
|
|
1406
|
+
onNodeChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1407
|
+
editor: PlateEditor;
|
|
1408
|
+
node: Descendant$1;
|
|
1409
|
+
operation: NodeOperation$1;
|
|
1410
|
+
prevNode: Descendant$1;
|
|
1411
|
+
}) => void) | null>;
|
|
1412
|
+
onSelectionChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1413
|
+
editor: PlateEditor;
|
|
1414
|
+
selection: TSelection$1;
|
|
1415
|
+
}) => void) | null>;
|
|
1416
|
+
onTextChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1417
|
+
editor: PlateEditor;
|
|
1418
|
+
node: Descendant$1;
|
|
1419
|
+
operation: TextOperation$1;
|
|
1420
|
+
prevText: string;
|
|
1421
|
+
text: string;
|
|
1422
|
+
}) => void) | null>;
|
|
1423
|
+
onValueChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1424
|
+
editor: PlateEditor;
|
|
1425
|
+
value: Value$1;
|
|
1426
|
+
}) => void) | null>;
|
|
1427
|
+
id: jotai_x98.SimpleWritableAtom<string>;
|
|
1428
|
+
containerRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1429
|
+
editor: jotai_x98.SimpleWritableAtom<PlateEditor>;
|
|
1430
|
+
scrollRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1431
|
+
} & {
|
|
1432
|
+
trackedEditor: jotai10.Atom<{
|
|
1433
|
+
editor: any;
|
|
1434
|
+
version: number | null;
|
|
1435
|
+
}>;
|
|
1436
|
+
trackedSelection: jotai10.Atom<{
|
|
1437
|
+
selection: any;
|
|
1438
|
+
version: number | null;
|
|
1439
|
+
}>;
|
|
1440
|
+
trackedValue: jotai10.Atom<{
|
|
1441
|
+
value: any;
|
|
1442
|
+
version: number | null;
|
|
1443
|
+
}>;
|
|
1444
|
+
})[K$1] extends jotai10.Atom<infer V> ? V : never)>(key: K$1, options?: ({
|
|
1445
|
+
selector?: ((v: ({
|
|
1446
|
+
composing: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1447
|
+
decorate: jotai_x98.SimpleWritableAtom<((options: {
|
|
1448
|
+
editor: PlateEditor;
|
|
1449
|
+
entry: NodeEntry$1;
|
|
1450
|
+
}) => TRange$1[]) | null>;
|
|
1451
|
+
isMounted: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1452
|
+
primary: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1453
|
+
readOnly: jotai_x98.SimpleWritableAtom<boolean | null>;
|
|
1454
|
+
renderChunk: jotai_x98.SimpleWritableAtom<RenderChunkFn | null>;
|
|
1455
|
+
renderElement: jotai_x98.SimpleWritableAtom<RenderElementFn | null>;
|
|
1456
|
+
renderLeaf: jotai_x98.SimpleWritableAtom<RenderLeafFn | null>;
|
|
1457
|
+
renderText: jotai_x98.SimpleWritableAtom<RenderTextFn | null>;
|
|
1458
|
+
versionDecorate: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1459
|
+
versionEditor: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1460
|
+
versionSelection: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1461
|
+
versionValue: jotai_x98.SimpleWritableAtom<number | null>;
|
|
1462
|
+
onChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1463
|
+
editor: PlateEditor;
|
|
1464
|
+
value: Value$1;
|
|
1465
|
+
}) => void) | null>;
|
|
1466
|
+
onNodeChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1467
|
+
editor: PlateEditor;
|
|
1468
|
+
node: Descendant$1;
|
|
1469
|
+
operation: NodeOperation$1;
|
|
1470
|
+
prevNode: Descendant$1;
|
|
1471
|
+
}) => void) | null>;
|
|
1472
|
+
onSelectionChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1473
|
+
editor: PlateEditor;
|
|
1474
|
+
selection: TSelection$1;
|
|
1475
|
+
}) => void) | null>;
|
|
1476
|
+
onTextChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1477
|
+
editor: PlateEditor;
|
|
1478
|
+
node: Descendant$1;
|
|
1479
|
+
operation: TextOperation$1;
|
|
1480
|
+
prevText: string;
|
|
1481
|
+
text: string;
|
|
1482
|
+
}) => void) | null>;
|
|
1483
|
+
onValueChange: jotai_x98.SimpleWritableAtom<((options: {
|
|
1484
|
+
editor: PlateEditor;
|
|
1485
|
+
value: Value$1;
|
|
1486
|
+
}) => void) | null>;
|
|
1487
|
+
id: jotai_x98.SimpleWritableAtom<string>;
|
|
1488
|
+
containerRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1489
|
+
editor: jotai_x98.SimpleWritableAtom<PlateEditor>;
|
|
1490
|
+
scrollRef: jotai_x98.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1491
|
+
} & {
|
|
1492
|
+
trackedEditor: jotai10.Atom<{
|
|
1493
|
+
editor: any;
|
|
1494
|
+
version: number | null;
|
|
1495
|
+
}>;
|
|
1496
|
+
trackedSelection: jotai10.Atom<{
|
|
1497
|
+
selection: any;
|
|
1498
|
+
version: number | null;
|
|
1499
|
+
}>;
|
|
1500
|
+
trackedValue: jotai10.Atom<{
|
|
1501
|
+
value: any;
|
|
1502
|
+
version: number | null;
|
|
1503
|
+
}>;
|
|
1504
|
+
})[K$1] extends jotai10.Atom<infer V_1> ? V_1 : never, prevSelectorOutput?: S | undefined) => S) | undefined;
|
|
1505
|
+
equalityFn?: ((prev: S, next: S) => boolean) | undefined;
|
|
1506
|
+
} & jotai_x98.UseAtomOptions) | undefined, deps?: unknown[]) => S;
|
|
1507
|
+
declare const usePlateStore: (id?: string) => jotai_x98.ReturnOfUseStoreApi<PlateStoreState<PlateEditor>, {
|
|
1508
|
+
trackedEditor: jotai10.Atom<{
|
|
1509
|
+
editor: any;
|
|
1510
|
+
version: number | null;
|
|
1511
|
+
}>;
|
|
1512
|
+
trackedSelection: jotai10.Atom<{
|
|
1513
|
+
selection: any;
|
|
1514
|
+
version: number | null;
|
|
1515
|
+
}>;
|
|
1516
|
+
trackedValue: jotai10.Atom<{
|
|
1517
|
+
value: any;
|
|
1518
|
+
version: number | null;
|
|
1519
|
+
}>;
|
|
1520
|
+
}>;
|
|
1521
|
+
declare const usePlateSet: typeof usePlateLocalSet;
|
|
1522
|
+
declare const usePlateValue: typeof usePlateLocalValue;
|
|
1523
|
+
declare const usePlateState: typeof usePlateLocalState;
|
|
1524
|
+
/** Get the closest `Plate` id. */
|
|
1525
|
+
declare const useEditorId: () => string;
|
|
1526
|
+
declare const useEditorContainerRef: (id?: string) => React$1.RefObject<HTMLDivElement | null>;
|
|
1527
|
+
declare const useEditorScrollRef: (id?: string) => React$1.RefObject<HTMLDivElement | null>;
|
|
1528
|
+
/** Returns the scrollRef if it exists, otherwise returns the containerRef. */
|
|
1529
|
+
declare const useScrollRef: (id?: string) => React$1.RefObject<HTMLDivElement | null>;
|
|
1530
|
+
declare const useEditorMounted: (id?: string) => boolean;
|
|
1531
|
+
/**
|
|
1532
|
+
* Whether the editor is read-only. You can also use `useReadOnly` from
|
|
1533
|
+
* `slate-react` in node components.
|
|
1534
|
+
*/
|
|
1535
|
+
declare const useEditorReadOnly: (id?: string) => boolean;
|
|
1536
|
+
/** Whether the editor is composing. */
|
|
1537
|
+
declare const useEditorComposing: (id?: string) => boolean;
|
|
1538
|
+
/**
|
|
1539
|
+
* Get a reference to the editor instance that remains stable across re-renders.
|
|
1540
|
+
* The editor object is enhanced with a `store` property that provides access to
|
|
1541
|
+
* the Plate store.
|
|
1542
|
+
*
|
|
1543
|
+
* @example
|
|
1544
|
+
* ```tsx
|
|
1545
|
+
* const editor = useEditorRef();
|
|
1546
|
+
* const readOnly = useAtomStoreValue(editor.store, 'readOnly');
|
|
1547
|
+
*/
|
|
1548
|
+
declare const useEditorRef: <E extends PlateEditor = PlateEditor>(id?: string) => E & {
|
|
1549
|
+
store: PlateStore;
|
|
1550
|
+
};
|
|
1551
|
+
/** Get the editor selection (deeply memoized). */
|
|
1552
|
+
declare const useEditorSelection: (id?: string) => any;
|
|
1553
|
+
/** Get editor state which is updated on editor change. */
|
|
1554
|
+
declare const useEditorState: <E extends PlateEditor = PlateEditor>(id?: string) => E;
|
|
1555
|
+
/** Version incremented on each editor change. */
|
|
1556
|
+
declare const useEditorVersion: (id?: string) => number | null;
|
|
1557
|
+
/** Version incremented on selection change. */
|
|
1558
|
+
declare const useSelectionVersion: (id?: string) => number | null;
|
|
1559
|
+
/** Get the editor value (deeply memoized). */
|
|
1560
|
+
declare const useEditorValue: (id?: string) => any;
|
|
1561
|
+
/** Version incremented on value change. */
|
|
1562
|
+
declare const useValueVersion: (id?: string) => number | null;
|
|
1563
|
+
declare const useIncrementVersion: (key: PlateChangeKey, id?: string) => () => void;
|
|
1564
|
+
declare const useRedecorate: (id?: string) => () => void;
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/react/stores/plate/useEditorPlugin.d.ts
|
|
1567
|
+
/** Get editor and plugin context. */
|
|
1568
|
+
declare function useEditorPlugin<P$1 extends AnyPluginConfig | PlatePlugin<AnyPluginConfig>, E extends PlateEditor = PlateEditor>(p: WithRequiredKey<P$1>, id?: string): PlatePluginContext<InferConfig<P$1> extends never ? P$1 : InferConfig<P$1>, E> & {
|
|
1569
|
+
store: PlateStore;
|
|
1570
|
+
};
|
|
1571
|
+
//#endregion
|
|
1572
|
+
//#region src/react/stores/plate/useEditorSelector.d.ts
|
|
1573
|
+
type UseEditorSelectorOptions<T> = {
|
|
1574
|
+
id?: string;
|
|
1575
|
+
equalityFn?: (a: T, b: T) => boolean;
|
|
1576
|
+
};
|
|
1577
|
+
declare const useEditorSelector: <T, E extends PlateEditor = PlateEditor>(selector: (editor: E, prev?: T) => T, deps: React$1.DependencyList, {
|
|
1578
|
+
id,
|
|
1579
|
+
equalityFn
|
|
1580
|
+
}?: UseEditorSelectorOptions<T>) => T;
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region src/react/stores/plate/usePluginOption.d.ts
|
|
1583
|
+
/**
|
|
1584
|
+
* Hook to access plugin options. For usage outside `<Plate>`, use
|
|
1585
|
+
* `useEditorPluginOption` instead.
|
|
1586
|
+
*
|
|
1587
|
+
* @example
|
|
1588
|
+
* const value = usePluginOption(plugin, 'value');
|
|
1589
|
+
* const doubleValue = usePluginOption(plugin, 'doubleValue', 2);
|
|
1590
|
+
*/
|
|
1591
|
+
declare function usePluginOption<C extends AnyPluginConfig, StateType extends InferOptions<C>, TSelectors extends InferSelectors<C>, K$1 extends keyof StateType | keyof TSelectors | 'state'>(plugin: WithRequiredKey<C>, key: K$1, ...args: [...(K$1 extends keyof TSelectors ? Parameters<TSelectors[K$1]> : unknown[]), TEqualityChecker<K$1 extends 'state' ? StateType : K$1 extends keyof TSelectors ? ReturnType<TSelectors[K$1]> : K$1 extends keyof StateType ? StateType[K$1] : never>?]): K$1 extends 'state' ? StateType : K$1 extends keyof TSelectors ? ReturnType<TSelectors[K$1]> : K$1 extends keyof StateType ? StateType[K$1] : never;
|
|
1592
|
+
declare function useEditorPluginOption<C extends AnyPluginConfig, StateType extends InferOptions<C>, TSelectors extends InferSelectors<C>, K$1 extends keyof StateType | keyof TSelectors | 'state'>(editor: PlateEditor, plugin: WithRequiredKey<C>, key: K$1, ...args: [...(K$1 extends keyof TSelectors ? Parameters<TSelectors[K$1]> : unknown[]), TEqualityChecker<K$1 extends 'state' ? StateType : K$1 extends keyof TSelectors ? ReturnType<TSelectors[K$1]> : K$1 extends keyof StateType ? StateType[K$1] : never>?]): K$1 extends 'state' ? StateType : K$1 extends keyof TSelectors ? ReturnType<TSelectors[K$1]> : K$1 extends keyof StateType ? StateType[K$1] : never;
|
|
1593
|
+
/**
|
|
1594
|
+
* Use zustand store selector.
|
|
1595
|
+
*
|
|
1596
|
+
* @example
|
|
1597
|
+
* const name = usePluginOptions(plugin, (state) => state.name, equalityFn);
|
|
1598
|
+
*/
|
|
1599
|
+
declare function usePluginOptions<C extends AnyPluginConfig, U>(plugin: WithRequiredKey<C>, selector: (state: InferOptions<C>) => U, {
|
|
1600
|
+
id,
|
|
1601
|
+
equalityFn
|
|
1602
|
+
}?: {
|
|
1603
|
+
id?: string;
|
|
1604
|
+
equalityFn?: (a: U, b: U) => boolean;
|
|
1605
|
+
}): U;
|
|
1606
|
+
declare function useEditorPluginOptions<C extends AnyPluginConfig, U>(editor: PlateEditor, plugin: WithRequiredKey<C>, selector: (state: InferOptions<C>) => U, {
|
|
1607
|
+
equalityFn
|
|
1608
|
+
}?: {
|
|
1609
|
+
equalityFn?: (a: U, b: U) => boolean;
|
|
1610
|
+
}): U;
|
|
1611
|
+
//#endregion
|
|
1612
|
+
//#region src/react/stores/plate-controller/plateControllerStore.d.ts
|
|
1613
|
+
declare const PlateController: React$1.FC<jotai_x98.ProviderProps<{
|
|
1614
|
+
activeId: string | null;
|
|
1615
|
+
editorStores: Record<string, ({
|
|
1616
|
+
get: <Value$2>(atom: Atom<Value$2>) => Value$2;
|
|
1617
|
+
set: <Value$2, Args extends unknown[], Result>(atom: jotai10.WritableAtom<Value$2, Args, Result>, ...args: Args) => Result;
|
|
1618
|
+
sub: (atom: Atom<unknown>, listener: () => void) => () => void;
|
|
1619
|
+
} & Partial<{
|
|
1620
|
+
dev_subscribe_store: (l: (action: {
|
|
1621
|
+
type: "write";
|
|
1622
|
+
flushed: Set<Atom<unknown>>;
|
|
1623
|
+
} | {
|
|
1624
|
+
type: "async-write";
|
|
1625
|
+
flushed: Set<Atom<unknown>>;
|
|
1626
|
+
} | {
|
|
1627
|
+
type: "sub";
|
|
1628
|
+
flushed: Set<Atom<unknown>>;
|
|
1629
|
+
} | {
|
|
1630
|
+
type: "unsub";
|
|
1631
|
+
} | {
|
|
1632
|
+
type: "restore";
|
|
1633
|
+
flushed: Set<Atom<unknown>>;
|
|
1634
|
+
}) => void, rev: 2) => () => void;
|
|
1635
|
+
dev_get_mounted_atoms: () => IterableIterator<Atom<unknown>>;
|
|
1636
|
+
dev_get_atom_state: (a: Atom<unknown>) => ({
|
|
1637
|
+
d: Map<Atom<unknown>, /*elided*/any & ({
|
|
1638
|
+
e: unknown;
|
|
1639
|
+
} | {
|
|
1640
|
+
v: unknown;
|
|
1641
|
+
})>;
|
|
1642
|
+
} & ({
|
|
1643
|
+
e: unknown;
|
|
1644
|
+
} | {
|
|
1645
|
+
v: unknown;
|
|
1646
|
+
})) | undefined;
|
|
1647
|
+
dev_get_mounted: (a: Atom<unknown>) => {
|
|
1648
|
+
l: Set<() => void>;
|
|
1649
|
+
t: Set<Atom<unknown>>;
|
|
1650
|
+
u?: () => void;
|
|
1651
|
+
} | undefined;
|
|
1652
|
+
dev_restore_atoms: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void;
|
|
1653
|
+
}>) | null>;
|
|
1654
|
+
primaryEditorIds: string[];
|
|
1655
|
+
}>>, plateControllerStore: jotai_x98.StoreApi<{
|
|
1656
|
+
activeId: jotai10.PrimitiveAtom<string | null> & {
|
|
1657
|
+
init: string | null;
|
|
1658
|
+
};
|
|
1659
|
+
editorStores: jotai10.PrimitiveAtom<Record<string, ({
|
|
1660
|
+
get: <Value$2>(atom: Atom<Value$2>) => Value$2;
|
|
1661
|
+
set: <Value$2, Args extends unknown[], Result>(atom: jotai10.WritableAtom<Value$2, Args, Result>, ...args: Args) => Result;
|
|
1662
|
+
sub: (atom: Atom<unknown>, listener: () => void) => () => void;
|
|
1663
|
+
} & Partial<{
|
|
1664
|
+
dev_subscribe_store: (l: (action: {
|
|
1665
|
+
type: "write";
|
|
1666
|
+
flushed: Set<Atom<unknown>>;
|
|
1667
|
+
} | {
|
|
1668
|
+
type: "async-write";
|
|
1669
|
+
flushed: Set<Atom<unknown>>;
|
|
1670
|
+
} | {
|
|
1671
|
+
type: "sub";
|
|
1672
|
+
flushed: Set<Atom<unknown>>;
|
|
1673
|
+
} | {
|
|
1674
|
+
type: "unsub";
|
|
1675
|
+
} | {
|
|
1676
|
+
type: "restore";
|
|
1677
|
+
flushed: Set<Atom<unknown>>;
|
|
1678
|
+
}) => void, rev: 2) => () => void;
|
|
1679
|
+
dev_get_mounted_atoms: () => IterableIterator<Atom<unknown>>;
|
|
1680
|
+
dev_get_atom_state: (a: Atom<unknown>) => ({
|
|
1681
|
+
d: Map<Atom<unknown>, /*elided*/any & ({
|
|
1682
|
+
e: unknown;
|
|
1683
|
+
} | {
|
|
1684
|
+
v: unknown;
|
|
1685
|
+
})>;
|
|
1686
|
+
} & ({
|
|
1687
|
+
e: unknown;
|
|
1688
|
+
} | {
|
|
1689
|
+
v: unknown;
|
|
1690
|
+
})) | undefined;
|
|
1691
|
+
dev_get_mounted: (a: Atom<unknown>) => {
|
|
1692
|
+
l: Set<() => void>;
|
|
1693
|
+
t: Set<Atom<unknown>>;
|
|
1694
|
+
u?: () => void;
|
|
1695
|
+
} | undefined;
|
|
1696
|
+
dev_restore_atoms: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void;
|
|
1697
|
+
}>) | null>> & {
|
|
1698
|
+
init: Record<string, ({
|
|
1699
|
+
get: <Value$2>(atom: Atom<Value$2>) => Value$2;
|
|
1700
|
+
set: <Value$2, Args extends unknown[], Result>(atom: jotai10.WritableAtom<Value$2, Args, Result>, ...args: Args) => Result;
|
|
1701
|
+
sub: (atom: Atom<unknown>, listener: () => void) => () => void;
|
|
1702
|
+
} & Partial<{
|
|
1703
|
+
dev_subscribe_store: (l: (action: {
|
|
1704
|
+
type: "write";
|
|
1705
|
+
flushed: Set<Atom<unknown>>;
|
|
1706
|
+
} | {
|
|
1707
|
+
type: "async-write";
|
|
1708
|
+
flushed: Set<Atom<unknown>>;
|
|
1709
|
+
} | {
|
|
1710
|
+
type: "sub";
|
|
1711
|
+
flushed: Set<Atom<unknown>>;
|
|
1712
|
+
} | {
|
|
1713
|
+
type: "unsub";
|
|
1714
|
+
} | {
|
|
1715
|
+
type: "restore";
|
|
1716
|
+
flushed: Set<Atom<unknown>>;
|
|
1717
|
+
}) => void, rev: 2) => () => void;
|
|
1718
|
+
dev_get_mounted_atoms: () => IterableIterator<Atom<unknown>>;
|
|
1719
|
+
dev_get_atom_state: (a: Atom<unknown>) => ({
|
|
1720
|
+
d: Map<Atom<unknown>, /*elided*/any & ({
|
|
1721
|
+
e: unknown;
|
|
1722
|
+
} | {
|
|
1723
|
+
v: unknown;
|
|
1724
|
+
})>;
|
|
1725
|
+
} & ({
|
|
1726
|
+
e: unknown;
|
|
1727
|
+
} | {
|
|
1728
|
+
v: unknown;
|
|
1729
|
+
})) | undefined;
|
|
1730
|
+
dev_get_mounted: (a: Atom<unknown>) => {
|
|
1731
|
+
l: Set<() => void>;
|
|
1732
|
+
t: Set<Atom<unknown>>;
|
|
1733
|
+
u?: () => void;
|
|
1734
|
+
} | undefined;
|
|
1735
|
+
dev_restore_atoms: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void;
|
|
1736
|
+
}>) | null>;
|
|
1737
|
+
};
|
|
1738
|
+
primaryEditorIds: jotai10.PrimitiveAtom<string[]> & {
|
|
1739
|
+
init: string[];
|
|
1740
|
+
};
|
|
1741
|
+
}, object, "plateController">, _usePlateControllerStore: jotai_x98.UseStoreApi<{
|
|
1742
|
+
activeId: jotai10.PrimitiveAtom<string | null> & {
|
|
1743
|
+
init: string | null;
|
|
1744
|
+
};
|
|
1745
|
+
editorStores: jotai10.PrimitiveAtom<Record<string, ({
|
|
1746
|
+
get: <Value$2>(atom: Atom<Value$2>) => Value$2;
|
|
1747
|
+
set: <Value$2, Args extends unknown[], Result>(atom: jotai10.WritableAtom<Value$2, Args, Result>, ...args: Args) => Result;
|
|
1748
|
+
sub: (atom: Atom<unknown>, listener: () => void) => () => void;
|
|
1749
|
+
} & Partial<{
|
|
1750
|
+
dev_subscribe_store: (l: (action: {
|
|
1751
|
+
type: "write";
|
|
1752
|
+
flushed: Set<Atom<unknown>>;
|
|
1753
|
+
} | {
|
|
1754
|
+
type: "async-write";
|
|
1755
|
+
flushed: Set<Atom<unknown>>;
|
|
1756
|
+
} | {
|
|
1757
|
+
type: "sub";
|
|
1758
|
+
flushed: Set<Atom<unknown>>;
|
|
1759
|
+
} | {
|
|
1760
|
+
type: "unsub";
|
|
1761
|
+
} | {
|
|
1762
|
+
type: "restore";
|
|
1763
|
+
flushed: Set<Atom<unknown>>;
|
|
1764
|
+
}) => void, rev: 2) => () => void;
|
|
1765
|
+
dev_get_mounted_atoms: () => IterableIterator<Atom<unknown>>;
|
|
1766
|
+
dev_get_atom_state: (a: Atom<unknown>) => ({
|
|
1767
|
+
d: Map<Atom<unknown>, /*elided*/any & ({
|
|
1768
|
+
e: unknown;
|
|
1769
|
+
} | {
|
|
1770
|
+
v: unknown;
|
|
1771
|
+
})>;
|
|
1772
|
+
} & ({
|
|
1773
|
+
e: unknown;
|
|
1774
|
+
} | {
|
|
1775
|
+
v: unknown;
|
|
1776
|
+
})) | undefined;
|
|
1777
|
+
dev_get_mounted: (a: Atom<unknown>) => {
|
|
1778
|
+
l: Set<() => void>;
|
|
1779
|
+
t: Set<Atom<unknown>>;
|
|
1780
|
+
u?: () => void;
|
|
1781
|
+
} | undefined;
|
|
1782
|
+
dev_restore_atoms: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void;
|
|
1783
|
+
}>) | null>> & {
|
|
1784
|
+
init: Record<string, ({
|
|
1785
|
+
get: <Value$2>(atom: Atom<Value$2>) => Value$2;
|
|
1786
|
+
set: <Value$2, Args extends unknown[], Result>(atom: jotai10.WritableAtom<Value$2, Args, Result>, ...args: Args) => Result;
|
|
1787
|
+
sub: (atom: Atom<unknown>, listener: () => void) => () => void;
|
|
1788
|
+
} & Partial<{
|
|
1789
|
+
dev_subscribe_store: (l: (action: {
|
|
1790
|
+
type: "write";
|
|
1791
|
+
flushed: Set<Atom<unknown>>;
|
|
1792
|
+
} | {
|
|
1793
|
+
type: "async-write";
|
|
1794
|
+
flushed: Set<Atom<unknown>>;
|
|
1795
|
+
} | {
|
|
1796
|
+
type: "sub";
|
|
1797
|
+
flushed: Set<Atom<unknown>>;
|
|
1798
|
+
} | {
|
|
1799
|
+
type: "unsub";
|
|
1800
|
+
} | {
|
|
1801
|
+
type: "restore";
|
|
1802
|
+
flushed: Set<Atom<unknown>>;
|
|
1803
|
+
}) => void, rev: 2) => () => void;
|
|
1804
|
+
dev_get_mounted_atoms: () => IterableIterator<Atom<unknown>>;
|
|
1805
|
+
dev_get_atom_state: (a: Atom<unknown>) => ({
|
|
1806
|
+
d: Map<Atom<unknown>, /*elided*/any & ({
|
|
1807
|
+
e: unknown;
|
|
1808
|
+
} | {
|
|
1809
|
+
v: unknown;
|
|
1810
|
+
})>;
|
|
1811
|
+
} & ({
|
|
1812
|
+
e: unknown;
|
|
1813
|
+
} | {
|
|
1814
|
+
v: unknown;
|
|
1815
|
+
})) | undefined;
|
|
1816
|
+
dev_get_mounted: (a: Atom<unknown>) => {
|
|
1817
|
+
l: Set<() => void>;
|
|
1818
|
+
t: Set<Atom<unknown>>;
|
|
1819
|
+
u?: () => void;
|
|
1820
|
+
} | undefined;
|
|
1821
|
+
dev_restore_atoms: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void;
|
|
1822
|
+
}>) | null>;
|
|
1823
|
+
};
|
|
1824
|
+
primaryEditorIds: jotai10.PrimitiveAtom<string[]> & {
|
|
1825
|
+
init: string[];
|
|
1826
|
+
};
|
|
1827
|
+
}, object>;
|
|
1828
|
+
declare const usePlateControllerLocalStore: typeof _usePlateControllerStore;
|
|
1829
|
+
declare const usePlateControllerExists: () => boolean;
|
|
1830
|
+
/**
|
|
1831
|
+
* Retrieve from PlateController the JotaiStore for the editor with a given ID,
|
|
1832
|
+
* or the active editor if no ID is provided, or the first primary editor if no
|
|
1833
|
+
* editor is active, or null.
|
|
1834
|
+
*/
|
|
1835
|
+
declare const usePlateControllerStore: (idProp?: string) => JotaiStore | null;
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region src/react/components/Plate.d.ts
|
|
1838
|
+
interface PlateProps<E extends PlateEditor = PlateEditor> extends Partial<Pick<PlateStoreState<E>, 'decorate' | 'onChange' | 'onNodeChange' | 'onSelectionChange' | 'onTextChange' | 'onValueChange' | 'primary' | 'readOnly'>> {
|
|
1839
|
+
children: React$1.ReactNode;
|
|
1840
|
+
editor: E | null;
|
|
1841
|
+
renderElement?: EditableProps['renderElement'];
|
|
1842
|
+
renderLeaf?: EditableProps['renderLeaf'];
|
|
1843
|
+
suppressInstanceWarning?: boolean;
|
|
1844
|
+
}
|
|
1845
|
+
declare function Plate<E extends PlateEditor = PlateEditor>(props: PlateProps<E>): React$1.JSX.Element | null;
|
|
1846
|
+
//#endregion
|
|
1847
|
+
//#region src/react/components/PlateContainer.d.ts
|
|
1848
|
+
declare const PlateContainer: {
|
|
1849
|
+
({
|
|
1850
|
+
children,
|
|
1851
|
+
...props
|
|
1852
|
+
}: HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
1853
|
+
displayName: string;
|
|
1854
|
+
};
|
|
1855
|
+
//#endregion
|
|
1856
|
+
//#region src/react/components/PlateContent.d.ts
|
|
1857
|
+
type PlateContentProps = Omit<EditableProps, 'decorate'> & {
|
|
1858
|
+
/** Autofocus when it becomes editable (readOnly false -> readOnly true) */
|
|
1859
|
+
autoFocusOnEditable?: boolean;
|
|
1860
|
+
decorate?: PlateStoreState['decorate'];
|
|
1861
|
+
disabled?: boolean;
|
|
1862
|
+
/** R enders the editable content. */
|
|
1863
|
+
renderEditable?: (editable: React$1.ReactElement<any>) => React$1.ReactNode;
|
|
1864
|
+
};
|
|
1865
|
+
/**
|
|
1866
|
+
* Editable with plugins.
|
|
1867
|
+
*
|
|
1868
|
+
* - Decorate prop
|
|
1869
|
+
* - DOM handler props
|
|
1870
|
+
* - ReadOnly prop
|
|
1871
|
+
* - Render.afterEditable
|
|
1872
|
+
* - Render.beforeEditable
|
|
1873
|
+
* - RenderElement prop
|
|
1874
|
+
* - RenderLeaf prop
|
|
1875
|
+
* - UseHooks
|
|
1876
|
+
*/
|
|
1877
|
+
declare const PlateContent: React$1.ForwardRefExoticComponent<Omit<EditableProps, "decorate"> & {
|
|
1878
|
+
/** Autofocus when it becomes editable (readOnly false -> readOnly true) */
|
|
1879
|
+
autoFocusOnEditable?: boolean;
|
|
1880
|
+
decorate?: PlateStoreState["decorate"];
|
|
1881
|
+
disabled?: boolean;
|
|
1882
|
+
/** R enders the editable content. */
|
|
1883
|
+
renderEditable?: (editable: React$1.ReactElement<any>) => React$1.ReactNode;
|
|
1884
|
+
} & React$1.RefAttributes<unknown>>;
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region src/react/components/PlateControllerEffect.d.ts
|
|
1887
|
+
type PlateControllerEffectProps = {
|
|
1888
|
+
id?: string;
|
|
1889
|
+
};
|
|
1890
|
+
declare const PlateControllerEffect: ({
|
|
1891
|
+
id: idProp
|
|
1892
|
+
}: PlateControllerEffectProps) => null;
|
|
1893
|
+
//#endregion
|
|
1894
|
+
//#region src/react/components/PlateSlate.d.ts
|
|
1895
|
+
/**
|
|
1896
|
+
* Slate with plugins.
|
|
1897
|
+
*
|
|
1898
|
+
* - OnChange prop
|
|
1899
|
+
* - RenderAboveSlate
|
|
1900
|
+
*/
|
|
1901
|
+
declare function PlateSlate({
|
|
1902
|
+
id,
|
|
1903
|
+
children
|
|
1904
|
+
}: {
|
|
1905
|
+
children: React$1.ReactNode;
|
|
1906
|
+
id?: string;
|
|
1907
|
+
}): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>>;
|
|
1908
|
+
//#endregion
|
|
1909
|
+
//#region src/react/components/PlateTest.d.ts
|
|
1910
|
+
declare function PlateTest({
|
|
1911
|
+
editableProps,
|
|
1912
|
+
shouldNormalizeEditor,
|
|
1913
|
+
variant,
|
|
1914
|
+
...props
|
|
1915
|
+
}: CreatePlateEditorOptions & PlateProps & {
|
|
1916
|
+
editableProps?: PlateContentProps;
|
|
1917
|
+
variant?: 'comment' | 'wordProcessor';
|
|
1918
|
+
}): React$1.JSX.Element;
|
|
1919
|
+
//#endregion
|
|
1920
|
+
//#region src/react/components/PlateView.d.ts
|
|
1921
|
+
type PlateViewProps = PlateStaticProps & {};
|
|
1922
|
+
declare const PlateView: (props: PlateViewProps) => React$1.JSX.Element;
|
|
1923
|
+
//#endregion
|
|
1924
|
+
//#region src/react/components/withHOC.d.ts
|
|
1925
|
+
type RefComponent<P$1, R$1> = React$1.FC<P$1> & {
|
|
1926
|
+
ref?: React$1.Ref<R$1>;
|
|
1927
|
+
};
|
|
1928
|
+
declare const withHOC: <ComponentProps, HOCProps, ComponentRef, HOCRef>(HOC: RefComponent<HOCProps, HOCRef>, Component: RefComponent<ComponentProps, ComponentRef>, hocProps?: Omit<HOCProps, "children">, hocRef?: React$1.Ref<HOCRef>) => React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<ComponentProps> & React$1.RefAttributes<ComponentRef>>;
|
|
1929
|
+
//#endregion
|
|
1930
|
+
//#region src/react/hooks/useEditableProps.d.ts
|
|
1931
|
+
declare const useEditableProps: ({
|
|
1932
|
+
disabled,
|
|
1933
|
+
readOnly,
|
|
1934
|
+
...editableProps
|
|
1935
|
+
}?: Omit<EditableProps, "decorate"> & Pick<PlateProps, "decorate">) => EditableProps;
|
|
1936
|
+
//#endregion
|
|
1937
|
+
//#region src/react/hooks/useNodePath.d.ts
|
|
1938
|
+
/**
|
|
1939
|
+
* Returns the path of a node every time the node changes. Note, however, that
|
|
1940
|
+
* if another node is updated in a way that affects this node's path, this hook
|
|
1941
|
+
* will not return the new path.
|
|
1942
|
+
*/
|
|
1943
|
+
declare const useNodePath: (node: TNode) => _platejs_slate0.Path | undefined;
|
|
1944
|
+
//#endregion
|
|
1945
|
+
//#region src/react/hooks/useSlateProps.d.ts
|
|
1946
|
+
type SlateComponentProps = Omit<React$1.ComponentProps<typeof Slate>, 'children'>;
|
|
1947
|
+
interface PlateSlateProps extends SlateComponentProps {
|
|
1948
|
+
key: React$1.Key;
|
|
1949
|
+
}
|
|
1950
|
+
/** Get Slate props stored in a global store. */
|
|
1951
|
+
declare const useSlateProps: ({
|
|
1952
|
+
id
|
|
1953
|
+
}: {
|
|
1954
|
+
id?: string;
|
|
1955
|
+
}) => PlateSlateProps;
|
|
1956
|
+
//#endregion
|
|
1957
|
+
//#region src/react/utils/createPlateFallbackEditor.d.ts
|
|
1958
|
+
declare const createPlateFallbackEditor: (options?: CreatePlateEditorOptions) => TPlateEditor<_platejs_slate0.Value, PlateCorePlugin>;
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region src/react/utils/dom-attributes.d.ts
|
|
1961
|
+
declare const DOM_HANDLERS: (keyof DOMHandlers)[];
|
|
1962
|
+
//#endregion
|
|
1963
|
+
//#region src/react/utils/getRenderNodeProps.d.ts
|
|
1964
|
+
/**
|
|
1965
|
+
* Override node props with plugin props. Allowed properties in
|
|
1966
|
+
* `props.element.attributes` are passed into `props.attributes`. Extend the
|
|
1967
|
+
* class name with the node type.
|
|
1968
|
+
*/
|
|
1969
|
+
declare const getRenderNodeProps: ({
|
|
1970
|
+
attributes: nodeAttributes,
|
|
1971
|
+
disableInjectNodeProps,
|
|
1972
|
+
editor,
|
|
1973
|
+
plugin,
|
|
1974
|
+
props,
|
|
1975
|
+
readOnly
|
|
1976
|
+
}: {
|
|
1977
|
+
editor: PlateEditor;
|
|
1978
|
+
props: PlateHTMLProps;
|
|
1979
|
+
attributes?: AnyObject;
|
|
1980
|
+
disableInjectNodeProps?: boolean;
|
|
1981
|
+
plugin?: AnyEditorPlatePlugin;
|
|
1982
|
+
readOnly?: boolean;
|
|
1983
|
+
}) => PlateHTMLProps;
|
|
1984
|
+
//#endregion
|
|
1985
|
+
//#region src/react/utils/pipeHandler.d.ts
|
|
1986
|
+
declare const convertDomEventToSyntheticEvent: (domEvent: Event) => React$1.SyntheticEvent<unknown, unknown>;
|
|
1987
|
+
/** Check if an event is overrided by a handler. */
|
|
1988
|
+
declare const isEventHandled: <EventType extends React$1.SyntheticEvent<unknown, unknown>>(event: EventType, handler?: (event: EventType) => boolean | void) => boolean;
|
|
1989
|
+
/**
|
|
1990
|
+
* Generic pipe for handlers.
|
|
1991
|
+
*
|
|
1992
|
+
* - Get all the plugins handlers by `handlerKey`.
|
|
1993
|
+
* - If there is no plugin handler or editable prop handler for this key, return
|
|
1994
|
+
* `undefined`.
|
|
1995
|
+
* - Return a handler calling all the plugins handlers then the prop handler.
|
|
1996
|
+
* - Any handler returning true will stop the next handlers to be called,
|
|
1997
|
+
* including slate internal handler.
|
|
1998
|
+
*/
|
|
1999
|
+
declare const pipeHandler: <K$1 extends keyof DOMHandlers>(editor: PlateEditor, {
|
|
2000
|
+
editableProps,
|
|
2001
|
+
handlerKey
|
|
2002
|
+
}: {
|
|
2003
|
+
handlerKey: K$1;
|
|
2004
|
+
editableProps?: Omit<EditableProps, "decorate"> | null;
|
|
2005
|
+
}) => ((event: any) => void) | undefined;
|
|
2006
|
+
//#endregion
|
|
2007
|
+
//#region src/react/utils/pipeOnChange.d.ts
|
|
2008
|
+
declare const pipeOnChange: (editor: PlateEditor, value: Value) => boolean;
|
|
2009
|
+
//#endregion
|
|
2010
|
+
//#region src/react/utils/pipeRenderElement.d.ts
|
|
2011
|
+
/** @see {@link RenderElement} */
|
|
2012
|
+
declare const pipeRenderElement: (editor: PlateEditor, renderElementProp?: EditableProps["renderElement"]) => EditableProps["renderElement"];
|
|
2013
|
+
//#endregion
|
|
2014
|
+
//#region src/react/utils/pipeRenderLeaf.d.ts
|
|
2015
|
+
/** @see {@link RenderLeaf} */
|
|
2016
|
+
declare const pipeRenderLeaf: (editor: PlateEditor, renderLeafProp?: EditableProps["renderLeaf"]) => EditableProps["renderLeaf"];
|
|
2017
|
+
//#endregion
|
|
2018
|
+
//#region src/react/utils/pipeRenderText.d.ts
|
|
2019
|
+
/** @see {@link RenderText} */
|
|
2020
|
+
declare const pipeRenderText: (editor: PlateEditor, renderTextProp?: EditableProps["renderText"]) => EditableProps["renderText"];
|
|
2021
|
+
//#endregion
|
|
2022
|
+
//#region src/react/utils/pluginRenderElement.d.ts
|
|
2023
|
+
/**
|
|
2024
|
+
* Function used to render an element. If the function returns undefined then
|
|
2025
|
+
* the next RenderElement function is called. If the function renders a JSX
|
|
2026
|
+
* element then that JSX element is rendered.
|
|
2027
|
+
*/
|
|
2028
|
+
type RenderElement = (props: PlateElementProps) => React$1.ReactElement<any> | undefined;
|
|
2029
|
+
declare function BelowRootNodes(props: any): React$1.JSX.Element;
|
|
2030
|
+
/**
|
|
2031
|
+
* Get a `Editable.renderElement` handler for `plugin.node.type`. If the type is
|
|
2032
|
+
* equals to the slate element type, render `plugin.render.node`. Else, return
|
|
2033
|
+
* `undefined` so the pipeline can check the next plugin.
|
|
2034
|
+
*/
|
|
2035
|
+
declare const pluginRenderElement: (editor: PlateEditor, plugin: AnyEditorPlatePlugin) => RenderElement;
|
|
2036
|
+
//#endregion
|
|
2037
|
+
//#region src/react/utils/pluginRenderLeaf.d.ts
|
|
2038
|
+
type RenderLeaf = (props: PlateLeafProps) => React$1.ReactElement<any>;
|
|
2039
|
+
/**
|
|
2040
|
+
* Get a `Editable.renderLeaf` handler for `plugin.node.type`. If the type is
|
|
2041
|
+
* equals to the slate leaf type, render `plugin.render.node`. Else, return
|
|
2042
|
+
* `children`.
|
|
2043
|
+
*/
|
|
2044
|
+
declare const pluginRenderLeaf: (editor: PlateEditor, plugin: AnyEditorPlatePlugin) => RenderLeaf;
|
|
2045
|
+
//#endregion
|
|
2046
|
+
//#region src/react/utils/pluginRenderText.d.ts
|
|
2047
|
+
type RenderText = (props: PlateTextProps) => React$1.ReactElement<any>;
|
|
2048
|
+
/**
|
|
2049
|
+
* Get a `Editable.renderText` handler for `plugin.node.type`. If the type is
|
|
2050
|
+
* equals to the slate text type and isDecoration is false, render
|
|
2051
|
+
* `plugin.render.node`. Else, return the default text rendering.
|
|
2052
|
+
*/
|
|
2053
|
+
declare const pluginRenderText: (editor: PlateEditor, plugin: AnyEditorPlatePlugin) => RenderText;
|
|
2054
|
+
//#endregion
|
|
2055
|
+
export { AnyEditorPlatePlugin, AnyPlatePlugin, BLUR_EDITOR_EVENT, BelowRootNodes, ContentVisibilityChunk, CreatePlateEditorOptions, DOMHandler, DOMHandlers, DOM_HANDLERS, Decorate, DefaultPlaceholder, Deserializer, Editable, EditableSiblingComponent, EditorHotkeysEffect, EditorMethodsEffect, EditorPlatePlugin, EditorRefEffect, EditorRefPluginEffect, ElementProvider, ElementStoreState, EventEditorPlugin, EventEditorState, EventEditorStore, ExtendEditor, ExtendEditorApi, ExtendEditorTransforms, FOCUS_EDITOR_EVENT, GLOBAL_PLATE_SCOPE, HtmlDeserializer, HtmlReactSerializer, HtmlSerializer, InferConfig, InjectNodeProps, KeyboardHandler, KeyofPlugins, LeafNodeProps, NodeProps, NodeWrapperComponent, NodeWrapperComponentProps, NodeWrapperComponentReturnType, NormalizeInitialValue, OnChange, OnNodeChange, OnTextChange, OverrideEditor, PLATE_SCOPE, ParagraphPlugin, Parser, Plate, PlateChangeKey, PlateChunkProps, PlateContainer, PlateContent, PlateContentProps, PlateController, PlateControllerEffect, PlateControllerEffectProps, PlateCorePlugin, PlateEditor, PlateElement, PlateElementProps, PlateHTMLProps, PlateLeaf, PlateLeafProps, PlateNodeProps, PlatePlugin, PlatePluginConfig, PlatePluginContext, PlatePluginMethods, PlatePlugins, PlateProps, PlateSlate, PlateStore, PlateStoreProvider, PlateStoreState, PlateTest, PlateText, PlateTextProps, PlateView, PlateViewProps, ReactPlugin, RenderElement, RenderLeaf, RenderNodeWrapper, RenderNodeWrapperFunction, RenderNodeWrapperProps, type RenderPlaceholderProps, RenderText, SCOPE_ELEMENT, Serializer, Shortcut, Shortcuts, Slate, SlateReactExtensionPlugin, StyledPlateElementProps, StyledPlateLeafProps, StyledPlateTextProps, TPlateEditor, TextNodeProps, TransformOptions, UseEditorSelectorOptions, UseHooks, WithPlateOptions, atom, convertDomEventToSyntheticEvent, createAtomStore, createPlateEditor, createPlateFallbackEditor, createPlatePlugin, createPlateStore, createTPlatePlugin, createZustandStore, elementStore, getEditorPlugin, getEventPlateId, getPlateCorePlugins, getPlugin, getRenderNodeProps, isEventHandled, omitPluginContext, pipeHandler, pipeOnChange, pipeRenderElement, pipeRenderLeaf, pipeRenderText, plateControllerStore, plateStore, pluginRenderElement, pluginRenderLeaf, pluginRenderText, toPlatePlugin, toTPlatePlugin, useComposing, useEditableProps, useEditorComposing, useEditorContainerRef, useEditorId, useEditorMounted, useEditorPlugin, useEditorPluginOption, useEditorPluginOptions, useEditorReadOnly, useEditorRef, useEditorScrollRef, useEditorSelection, useEditorSelector, useEditorState, useEditorValue, useEditorVersion, useElement, useElementSelector, useElementStore, useEventEditorValue, useEventPlateId, useFocusEditorEvents, useFocused, useFocusedLast, useIncrementVersion, useNodeAttributes, useNodePath, usePath, usePlateControllerExists, usePlateControllerLocalStore, usePlateControllerStore, usePlateEditor, usePlateLocalStore, usePlateSet, usePlateState, usePlateStore, usePlateValue, usePlateViewEditor, usePluginOption, usePluginOptions, useReadOnly, useRedecorate, useScrollRef, useSelected, useSelectionVersion, useSlateProps, useSlateStatic, useStoreAtomState, useStoreAtomValue, useStoreSelect, useStoreSetAtom, useStoreState, useStoreValue, useTracked, useTrackedStore, useValueVersion, withHOC, withPlate, withPlateReact, withReact };
|
|
2056
|
+
//# sourceMappingURL=index.d.ts.map
|