@lofcz/platejs-core 52.3.6 → 53.1.1
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/dist/{index-CLvWpTKx.d.ts → index-DRweaH9Q.d.ts} +459 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +105 -2
- package/dist/react/index.d.ts +100 -84
- package/dist/react/index.js +49 -6
- package/dist/static/index.d.ts +1 -1
- package/dist/static/index.js +2 -2
- package/dist/{static-DIYyt_jS.js → static-HrbPXDQ1.js} +2 -2
- package/dist/{withSlate-BfRR5wTZ.js → withSlate-DsAgt7dN.js} +846 -26
- package/package.json +5 -5
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ai as
|
|
2
|
-
import * as
|
|
1
|
+
import { Ai as AnySlatePlugin, Ct as NodeComponents, Et as PluginConfig, F as RenderLeafProps, I as RenderElementFn, J as BaseEditor, Kr as NavigationFeedbackActiveTarget, L as RenderElementProps, M as RenderTextFn, N as RenderTextProps, Ot as WithAnyKey, P as RenderLeafFn, Pi as ExtendEditor$1, Q as SlateEditor, R as RenderChunkFn, St as NodeComponent, Tt as ParserOptions, U as BaseWithSlateOptions, Y as InferPlugins, Ya as createStaticEditor, _a as InputRulesConfig, _t as InferOptions, at as BasePluginContext, bt as MatchRules, ct as BaseTransformOptions, ea as SlatePlugin, ei as AutoScrollOperationsMap, et as AnyPluginConfig, fi as InsertExitBreakOptions, gt as InferKey, hr as CorePluginTransforms, ht as InferApi, ii as WithAutoScrollOptions, it as BasePlugin, j as EditableProps, ja as ResolvedInputRulesMeta, ko as HandlerReturnType, kt as WithRequiredKey, mi as InitOptions, mr as CorePluginApi, mt as GetInjectNodePropsReturnType, na as SlatePluginContext, ni as DomConfig, nt as BaseHtmlDeserializer, pr as CorePlugin, pt as GetInjectNodePropsOptions, qr as NavigationFeedbackConfig, ri as ScrollMode, rt as BaseInjectProps, st as BaseSerializer, ta as SlatePluginConfig, tt as BaseDeserializer, ui as LiftBlockOptions, va as InputRulesDefinition, vt as InferSelectors, yo as PlateStaticProps, yt as InferTransforms, z as RenderChunkProps } from "../index-DRweaH9Q";
|
|
2
|
+
import * as _platejs_slate19 from "@platejs/slate";
|
|
3
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
4
|
import { AnyObject, Deep2Partial, Modify, Nullable, UnionToIntersection, UnknownObject } from "@udecode/utils";
|
|
5
5
|
import { DefaultPlaceholder, Editable, RenderPlaceholderProps, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
|
|
@@ -16,30 +16,31 @@ import { TCreatedStoreType, TEqualityChecker, createZustandStore, useStoreSelect
|
|
|
16
16
|
declare const SlateReactExtensionPlugin: PlatePlugin<PluginConfig<"slateExtension", {
|
|
17
17
|
onNodeChange: (options: {
|
|
18
18
|
editor: SlateEditor;
|
|
19
|
-
node:
|
|
20
|
-
operation:
|
|
21
|
-
prevNode:
|
|
19
|
+
node: _platejs_slate19.Descendant;
|
|
20
|
+
operation: _platejs_slate19.NodeOperation;
|
|
21
|
+
prevNode: _platejs_slate19.Descendant;
|
|
22
22
|
}) => void;
|
|
23
23
|
onTextChange: (options: {
|
|
24
24
|
editor: SlateEditor;
|
|
25
|
-
node:
|
|
26
|
-
operation:
|
|
25
|
+
node: _platejs_slate19.Descendant;
|
|
26
|
+
operation: _platejs_slate19.TextOperation;
|
|
27
27
|
prevText: string;
|
|
28
28
|
text: string;
|
|
29
29
|
}) => void;
|
|
30
30
|
}, {
|
|
31
31
|
redecorate: (() => void) & (() => void);
|
|
32
32
|
}, {
|
|
33
|
-
reset: (options:
|
|
33
|
+
reset: (options: _platejs_slate19.ResetOptions | undefined) => void;
|
|
34
34
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
35
35
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
36
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
36
37
|
resetBlock: ((args_0?: {
|
|
37
|
-
at?:
|
|
38
|
+
at?: _platejs_slate19.Path;
|
|
38
39
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
39
|
-
at?:
|
|
40
|
+
at?: _platejs_slate19.Path;
|
|
40
41
|
} | undefined) => true | undefined);
|
|
41
|
-
setValue: ((value?: string |
|
|
42
|
-
apply: <N$1 extends
|
|
42
|
+
setValue: ((value?: string | _platejs_slate19.Value | undefined) => void) & ((value?: string | _platejs_slate19.Value | undefined) => void);
|
|
43
|
+
apply: <N$1 extends _platejs_slate19.TElement | _platejs_slate19.TText>(operation: _platejs_slate19.Operation<N$1>) => void;
|
|
43
44
|
}, {}>>;
|
|
44
45
|
//#endregion
|
|
45
46
|
//#region src/react/plugins/event-editor/EventEditorPlugin.d.ts
|
|
@@ -84,6 +85,13 @@ declare const useFocusEditorEvents: ({
|
|
|
84
85
|
/** Whether the current editor is the last focused editor. */
|
|
85
86
|
declare const useFocusedLast: (id?: string) => boolean;
|
|
86
87
|
//#endregion
|
|
88
|
+
//#region src/react/plugins/navigation-feedback/NavigationFeedbackPlugin.d.ts
|
|
89
|
+
declare const NavigationFeedbackPlugin: PlatePlugin<PluginConfig<any, {}, {}, {}, {}>>;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/react/plugins/navigation-feedback/useNavigationHighlight.d.ts
|
|
92
|
+
type NavigationHighlightTarget = Path | TElement | TText | null | undefined;
|
|
93
|
+
declare const useNavigationHighlight: (target?: NavigationHighlightTarget) => NavigationFeedbackActiveTarget | null;
|
|
94
|
+
//#endregion
|
|
87
95
|
//#region src/react/plugins/paragraph/ParagraphPlugin.d.ts
|
|
88
96
|
declare const ParagraphPlugin: PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>;
|
|
89
97
|
//#endregion
|
|
@@ -92,7 +100,7 @@ declare const ParagraphPlugin: PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>;
|
|
|
92
100
|
declare const ReactPlugin: PlatePlugin<PluginConfig<"dom", {
|
|
93
101
|
scrollMode?: ScrollMode;
|
|
94
102
|
scrollOperations?: AutoScrollOperationsMap;
|
|
95
|
-
scrollOptions?:
|
|
103
|
+
scrollOptions?: _platejs_slate19.ScrollIntoViewOptions;
|
|
96
104
|
}, {
|
|
97
105
|
isScrolling: () => boolean;
|
|
98
106
|
}, {
|
|
@@ -174,6 +182,7 @@ declare const createPlateEditor: <V$1 extends Value = Value, P$1 extends AnyPlug
|
|
|
174
182
|
type PlateEditor = BaseEditor & {
|
|
175
183
|
api: EditorApi & UnionToIntersection<InferApi<PlateCorePlugin>>;
|
|
176
184
|
meta: BaseEditor['meta'] & {
|
|
185
|
+
inputRules: ResolvedInputRulesMeta;
|
|
177
186
|
pluginList: AnyEditorPlatePlugin[];
|
|
178
187
|
shortcuts: Shortcuts;
|
|
179
188
|
};
|
|
@@ -192,6 +201,7 @@ type TPlateEditor<V$1 extends Value = Value, P$1 extends AnyPluginConfig = Plate
|
|
|
192
201
|
api: EditorApi<V$1> & UnionToIntersection<InferApi<P$1 | PlateCorePlugin>>;
|
|
193
202
|
children: V$1;
|
|
194
203
|
meta: BaseEditor['meta'] & {
|
|
204
|
+
inputRules: ResolvedInputRulesMeta;
|
|
195
205
|
pluginList: P$1[];
|
|
196
206
|
shortcuts: Shortcuts;
|
|
197
207
|
};
|
|
@@ -512,6 +522,7 @@ type PlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nul
|
|
|
512
522
|
* method, an API method, or use a custom handler function.
|
|
513
523
|
*/
|
|
514
524
|
shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], Shortcut | null>>;
|
|
525
|
+
inputRules: InputRulesDefinition | InputRulesConfig;
|
|
515
526
|
useOptionsStore: TCreatedStoreType<C['options'], [['zustand/mutative-x', never]]>;
|
|
516
527
|
};
|
|
517
528
|
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'> & {
|
|
@@ -792,42 +803,47 @@ declare const createPlatePlugin: <K$1 extends string = any, O = {}, A$1 = {}, T
|
|
|
792
803
|
declare function createTPlatePlugin<C extends AnyPluginConfig = PluginConfig>(config?: ((editor: PlateEditor) => TPlatePluginConfig<C>) | TPlatePluginConfig<C>): PlatePlugin<C>;
|
|
793
804
|
//#endregion
|
|
794
805
|
//#region src/react/editor/getPlateCorePlugins.d.ts
|
|
795
|
-
declare const getPlateCorePlugins: (
|
|
806
|
+
declare const getPlateCorePlugins: ({
|
|
807
|
+
navigationFeedback
|
|
808
|
+
}?: {
|
|
809
|
+
navigationFeedback?: NavigationFeedbackConfig["options"] | boolean;
|
|
810
|
+
}) => (PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"slateExtension", {
|
|
796
811
|
onNodeChange: (options: {
|
|
797
812
|
editor: SlateEditor;
|
|
798
|
-
node:
|
|
799
|
-
operation:
|
|
800
|
-
prevNode:
|
|
813
|
+
node: _platejs_slate19.Descendant;
|
|
814
|
+
operation: _platejs_slate19.NodeOperation;
|
|
815
|
+
prevNode: _platejs_slate19.Descendant;
|
|
801
816
|
}) => void;
|
|
802
817
|
onTextChange: (options: {
|
|
803
818
|
editor: SlateEditor;
|
|
804
|
-
node:
|
|
805
|
-
operation:
|
|
819
|
+
node: _platejs_slate19.Descendant;
|
|
820
|
+
operation: _platejs_slate19.TextOperation;
|
|
806
821
|
prevText: string;
|
|
807
822
|
text: string;
|
|
808
823
|
}) => void;
|
|
809
824
|
}, {
|
|
810
825
|
redecorate: (() => void) & (() => void);
|
|
811
826
|
}, {
|
|
812
|
-
reset: (options:
|
|
827
|
+
reset: (options: _platejs_slate19.ResetOptions | undefined) => void;
|
|
813
828
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
814
829
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
830
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
815
831
|
resetBlock: ((args_0?: {
|
|
816
|
-
at?:
|
|
832
|
+
at?: _platejs_slate19.Path;
|
|
817
833
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
818
|
-
at?:
|
|
834
|
+
at?: _platejs_slate19.Path;
|
|
819
835
|
} | undefined) => true | undefined);
|
|
820
|
-
setValue: ((value?: string |
|
|
821
|
-
apply: <N$1 extends
|
|
822
|
-
}, {}>> | PlatePlugin<PluginConfig<"
|
|
836
|
+
setValue: ((value?: string | _platejs_slate19.Value | undefined) => void) & ((value?: string | _platejs_slate19.Value | undefined) => void);
|
|
837
|
+
apply: <N$1 extends _platejs_slate19.TElement | _platejs_slate19.TText>(operation: _platejs_slate19.Operation<N$1>) => void;
|
|
838
|
+
}, {}>> | PlatePlugin<PluginConfig<"dom", {
|
|
823
839
|
scrollMode?: ScrollMode;
|
|
824
840
|
scrollOperations?: AutoScrollOperationsMap;
|
|
825
|
-
scrollOptions?:
|
|
841
|
+
scrollOptions?: _platejs_slate19.ScrollIntoViewOptions;
|
|
826
842
|
}, {
|
|
827
843
|
isScrolling: () => boolean;
|
|
828
844
|
}, {
|
|
829
845
|
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
830
|
-
}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>)[];
|
|
846
|
+
}, {}>> | PlatePlugin<PluginConfig<any, {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>)[];
|
|
831
847
|
//#endregion
|
|
832
848
|
//#region src/react/editor/usePlateEditor.d.ts
|
|
833
849
|
/**
|
|
@@ -892,7 +908,7 @@ declare function getPlugin<C extends AnyPluginConfig = PluginConfig>(editor: Pla
|
|
|
892
908
|
} ? C : PlatePlugin<C>;
|
|
893
909
|
//#endregion
|
|
894
910
|
//#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"
|
|
911
|
+
declare const omitPluginContext: <T extends PlatePluginContext<AnyPlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "plugin" | "getOptions" | "getOption" | "tf" | "type" | "setOptions" | "setOption">;
|
|
896
912
|
//#endregion
|
|
897
913
|
//#region src/react/plugin/toPlatePlugin.d.ts
|
|
898
914
|
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'> & {
|
|
@@ -1196,8 +1212,8 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1196
1212
|
composing: boolean | null;
|
|
1197
1213
|
decorate: ((options: {
|
|
1198
1214
|
editor: PlateEditor;
|
|
1199
|
-
entry:
|
|
1200
|
-
}) =>
|
|
1215
|
+
entry: _platejs_slate19.NodeEntry;
|
|
1216
|
+
}) => _platejs_slate19.TRange[]) | null;
|
|
1201
1217
|
isMounted: boolean | null;
|
|
1202
1218
|
primary: boolean | null;
|
|
1203
1219
|
readOnly: boolean | null;
|
|
@@ -1211,28 +1227,28 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1211
1227
|
versionValue: number | null;
|
|
1212
1228
|
onChange: ((options: {
|
|
1213
1229
|
editor: PlateEditor;
|
|
1214
|
-
value:
|
|
1230
|
+
value: _platejs_slate19.Value;
|
|
1215
1231
|
}) => void) | null;
|
|
1216
1232
|
onNodeChange: ((options: {
|
|
1217
1233
|
editor: PlateEditor;
|
|
1218
|
-
node:
|
|
1219
|
-
operation:
|
|
1220
|
-
prevNode:
|
|
1234
|
+
node: _platejs_slate19.Descendant;
|
|
1235
|
+
operation: _platejs_slate19.NodeOperation;
|
|
1236
|
+
prevNode: _platejs_slate19.Descendant;
|
|
1221
1237
|
}) => void) | null;
|
|
1222
1238
|
onSelectionChange: ((options: {
|
|
1223
1239
|
editor: PlateEditor;
|
|
1224
|
-
selection:
|
|
1240
|
+
selection: _platejs_slate19.TSelection;
|
|
1225
1241
|
}) => void) | null;
|
|
1226
1242
|
onTextChange: ((options: {
|
|
1227
1243
|
editor: PlateEditor;
|
|
1228
|
-
node:
|
|
1229
|
-
operation:
|
|
1244
|
+
node: _platejs_slate19.Descendant;
|
|
1245
|
+
operation: _platejs_slate19.TextOperation;
|
|
1230
1246
|
prevText: string;
|
|
1231
1247
|
text: string;
|
|
1232
1248
|
}) => void) | null;
|
|
1233
1249
|
onValueChange: ((options: {
|
|
1234
1250
|
editor: PlateEditor;
|
|
1235
|
-
value:
|
|
1251
|
+
value: _platejs_slate19.Value;
|
|
1236
1252
|
}) => void) | null;
|
|
1237
1253
|
id: string;
|
|
1238
1254
|
containerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
@@ -1251,12 +1267,12 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1251
1267
|
value: any;
|
|
1252
1268
|
version: number | null;
|
|
1253
1269
|
}>;
|
|
1254
|
-
}, "plate">, usePlateLocalSet: <K$1 extends "
|
|
1270
|
+
}, "plate">, usePlateLocalSet: <K$1 extends "renderElement" | "decorate" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | jotai_x2.UseAtomOptions) => ({
|
|
1255
1271
|
composing: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1256
1272
|
decorate: jotai_x2.SimpleWritableAtom<((options: {
|
|
1257
1273
|
editor: PlateEditor;
|
|
1258
|
-
entry:
|
|
1259
|
-
}) =>
|
|
1274
|
+
entry: _platejs_slate19.NodeEntry;
|
|
1275
|
+
}) => _platejs_slate19.TRange[]) | null>;
|
|
1260
1276
|
isMounted: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1261
1277
|
primary: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1262
1278
|
readOnly: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
@@ -1270,28 +1286,28 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1270
1286
|
versionValue: jotai_x2.SimpleWritableAtom<number | null>;
|
|
1271
1287
|
onChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1272
1288
|
editor: PlateEditor;
|
|
1273
|
-
value:
|
|
1289
|
+
value: _platejs_slate19.Value;
|
|
1274
1290
|
}) => void) | null>;
|
|
1275
1291
|
onNodeChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1276
1292
|
editor: PlateEditor;
|
|
1277
|
-
node:
|
|
1278
|
-
operation:
|
|
1279
|
-
prevNode:
|
|
1293
|
+
node: _platejs_slate19.Descendant;
|
|
1294
|
+
operation: _platejs_slate19.NodeOperation;
|
|
1295
|
+
prevNode: _platejs_slate19.Descendant;
|
|
1280
1296
|
}) => void) | null>;
|
|
1281
1297
|
onSelectionChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1282
1298
|
editor: PlateEditor;
|
|
1283
|
-
selection:
|
|
1299
|
+
selection: _platejs_slate19.TSelection;
|
|
1284
1300
|
}) => void) | null>;
|
|
1285
1301
|
onTextChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1286
1302
|
editor: PlateEditor;
|
|
1287
|
-
node:
|
|
1288
|
-
operation:
|
|
1303
|
+
node: _platejs_slate19.Descendant;
|
|
1304
|
+
operation: _platejs_slate19.TextOperation;
|
|
1289
1305
|
prevText: string;
|
|
1290
1306
|
text: string;
|
|
1291
1307
|
}) => void) | null>;
|
|
1292
1308
|
onValueChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1293
1309
|
editor: PlateEditor;
|
|
1294
|
-
value:
|
|
1310
|
+
value: _platejs_slate19.Value;
|
|
1295
1311
|
}) => void) | null>;
|
|
1296
1312
|
id: jotai_x2.SimpleWritableAtom<string>;
|
|
1297
1313
|
containerRef: jotai_x2.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
@@ -1310,12 +1326,12 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1310
1326
|
value: any;
|
|
1311
1327
|
version: number | null;
|
|
1312
1328
|
}>;
|
|
1313
|
-
})[K$1] extends jotai10.WritableAtom<infer _V, infer A extends unknown[], infer R> ? (...args: A) => R : never, usePlateLocalState: <K$1 extends "
|
|
1329
|
+
})[K$1] extends jotai10.WritableAtom<infer _V, infer A extends unknown[], infer R> ? (...args: A) => R : never, usePlateLocalState: <K$1 extends "renderElement" | "decorate" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | jotai_x2.UseAtomOptions) => ({
|
|
1314
1330
|
composing: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1315
1331
|
decorate: jotai_x2.SimpleWritableAtom<((options: {
|
|
1316
1332
|
editor: PlateEditor;
|
|
1317
|
-
entry:
|
|
1318
|
-
}) =>
|
|
1333
|
+
entry: _platejs_slate19.NodeEntry;
|
|
1334
|
+
}) => _platejs_slate19.TRange[]) | null>;
|
|
1319
1335
|
isMounted: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1320
1336
|
primary: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1321
1337
|
readOnly: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
@@ -1329,28 +1345,28 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1329
1345
|
versionValue: jotai_x2.SimpleWritableAtom<number | null>;
|
|
1330
1346
|
onChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1331
1347
|
editor: PlateEditor;
|
|
1332
|
-
value:
|
|
1348
|
+
value: _platejs_slate19.Value;
|
|
1333
1349
|
}) => void) | null>;
|
|
1334
1350
|
onNodeChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1335
1351
|
editor: PlateEditor;
|
|
1336
|
-
node:
|
|
1337
|
-
operation:
|
|
1338
|
-
prevNode:
|
|
1352
|
+
node: _platejs_slate19.Descendant;
|
|
1353
|
+
operation: _platejs_slate19.NodeOperation;
|
|
1354
|
+
prevNode: _platejs_slate19.Descendant;
|
|
1339
1355
|
}) => void) | null>;
|
|
1340
1356
|
onSelectionChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1341
1357
|
editor: PlateEditor;
|
|
1342
|
-
selection:
|
|
1358
|
+
selection: _platejs_slate19.TSelection;
|
|
1343
1359
|
}) => void) | null>;
|
|
1344
1360
|
onTextChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1345
1361
|
editor: PlateEditor;
|
|
1346
|
-
node:
|
|
1347
|
-
operation:
|
|
1362
|
+
node: _platejs_slate19.Descendant;
|
|
1363
|
+
operation: _platejs_slate19.TextOperation;
|
|
1348
1364
|
prevText: string;
|
|
1349
1365
|
text: string;
|
|
1350
1366
|
}) => void) | null>;
|
|
1351
1367
|
onValueChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1352
1368
|
editor: PlateEditor;
|
|
1353
|
-
value:
|
|
1369
|
+
value: _platejs_slate19.Value;
|
|
1354
1370
|
}) => void) | null>;
|
|
1355
1371
|
id: jotai_x2.SimpleWritableAtom<string>;
|
|
1356
1372
|
containerRef: jotai_x2.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
@@ -1382,12 +1398,12 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1382
1398
|
value: any;
|
|
1383
1399
|
version: number | null;
|
|
1384
1400
|
}>;
|
|
1385
|
-
}>, usePlateLocalValue: <K$1 extends "
|
|
1401
|
+
}>, usePlateLocalValue: <K$1 extends "renderElement" | "decorate" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue", S = (({
|
|
1386
1402
|
composing: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1387
1403
|
decorate: jotai_x2.SimpleWritableAtom<((options: {
|
|
1388
1404
|
editor: PlateEditor;
|
|
1389
|
-
entry:
|
|
1390
|
-
}) =>
|
|
1405
|
+
entry: _platejs_slate19.NodeEntry;
|
|
1406
|
+
}) => _platejs_slate19.TRange[]) | null>;
|
|
1391
1407
|
isMounted: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1392
1408
|
primary: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1393
1409
|
readOnly: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
@@ -1401,28 +1417,28 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1401
1417
|
versionValue: jotai_x2.SimpleWritableAtom<number | null>;
|
|
1402
1418
|
onChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1403
1419
|
editor: PlateEditor;
|
|
1404
|
-
value:
|
|
1420
|
+
value: _platejs_slate19.Value;
|
|
1405
1421
|
}) => void) | null>;
|
|
1406
1422
|
onNodeChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1407
1423
|
editor: PlateEditor;
|
|
1408
|
-
node:
|
|
1409
|
-
operation:
|
|
1410
|
-
prevNode:
|
|
1424
|
+
node: _platejs_slate19.Descendant;
|
|
1425
|
+
operation: _platejs_slate19.NodeOperation;
|
|
1426
|
+
prevNode: _platejs_slate19.Descendant;
|
|
1411
1427
|
}) => void) | null>;
|
|
1412
1428
|
onSelectionChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1413
1429
|
editor: PlateEditor;
|
|
1414
|
-
selection:
|
|
1430
|
+
selection: _platejs_slate19.TSelection;
|
|
1415
1431
|
}) => void) | null>;
|
|
1416
1432
|
onTextChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1417
1433
|
editor: PlateEditor;
|
|
1418
|
-
node:
|
|
1419
|
-
operation:
|
|
1434
|
+
node: _platejs_slate19.Descendant;
|
|
1435
|
+
operation: _platejs_slate19.TextOperation;
|
|
1420
1436
|
prevText: string;
|
|
1421
1437
|
text: string;
|
|
1422
1438
|
}) => void) | null>;
|
|
1423
1439
|
onValueChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1424
1440
|
editor: PlateEditor;
|
|
1425
|
-
value:
|
|
1441
|
+
value: _platejs_slate19.Value;
|
|
1426
1442
|
}) => void) | null>;
|
|
1427
1443
|
id: jotai_x2.SimpleWritableAtom<string>;
|
|
1428
1444
|
containerRef: jotai_x2.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
@@ -1446,8 +1462,8 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1446
1462
|
composing: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1447
1463
|
decorate: jotai_x2.SimpleWritableAtom<((options: {
|
|
1448
1464
|
editor: PlateEditor;
|
|
1449
|
-
entry:
|
|
1450
|
-
}) =>
|
|
1465
|
+
entry: _platejs_slate19.NodeEntry;
|
|
1466
|
+
}) => _platejs_slate19.TRange[]) | null>;
|
|
1451
1467
|
isMounted: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1452
1468
|
primary: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
1453
1469
|
readOnly: jotai_x2.SimpleWritableAtom<boolean | null>;
|
|
@@ -1461,28 +1477,28 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1461
1477
|
versionValue: jotai_x2.SimpleWritableAtom<number | null>;
|
|
1462
1478
|
onChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1463
1479
|
editor: PlateEditor;
|
|
1464
|
-
value:
|
|
1480
|
+
value: _platejs_slate19.Value;
|
|
1465
1481
|
}) => void) | null>;
|
|
1466
1482
|
onNodeChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1467
1483
|
editor: PlateEditor;
|
|
1468
|
-
node:
|
|
1469
|
-
operation:
|
|
1470
|
-
prevNode:
|
|
1484
|
+
node: _platejs_slate19.Descendant;
|
|
1485
|
+
operation: _platejs_slate19.NodeOperation;
|
|
1486
|
+
prevNode: _platejs_slate19.Descendant;
|
|
1471
1487
|
}) => void) | null>;
|
|
1472
1488
|
onSelectionChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1473
1489
|
editor: PlateEditor;
|
|
1474
|
-
selection:
|
|
1490
|
+
selection: _platejs_slate19.TSelection;
|
|
1475
1491
|
}) => void) | null>;
|
|
1476
1492
|
onTextChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1477
1493
|
editor: PlateEditor;
|
|
1478
|
-
node:
|
|
1479
|
-
operation:
|
|
1494
|
+
node: _platejs_slate19.Descendant;
|
|
1495
|
+
operation: _platejs_slate19.TextOperation;
|
|
1480
1496
|
prevText: string;
|
|
1481
1497
|
text: string;
|
|
1482
1498
|
}) => void) | null>;
|
|
1483
1499
|
onValueChange: jotai_x2.SimpleWritableAtom<((options: {
|
|
1484
1500
|
editor: PlateEditor;
|
|
1485
|
-
value:
|
|
1501
|
+
value: _platejs_slate19.Value;
|
|
1486
1502
|
}) => void) | null>;
|
|
1487
1503
|
id: jotai_x2.SimpleWritableAtom<string>;
|
|
1488
1504
|
containerRef: jotai_x2.SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
@@ -1940,7 +1956,7 @@ declare const useEditableProps: ({
|
|
|
1940
1956
|
* if another node is updated in a way that affects this node's path, this hook
|
|
1941
1957
|
* will not return the new path.
|
|
1942
1958
|
*/
|
|
1943
|
-
declare const useNodePath: (node: TNode) =>
|
|
1959
|
+
declare const useNodePath: (node: TNode) => _platejs_slate19.Path | undefined;
|
|
1944
1960
|
//#endregion
|
|
1945
1961
|
//#region src/react/hooks/useSlateProps.d.ts
|
|
1946
1962
|
type SlateComponentProps = Omit<React$1.ComponentProps<typeof Slate>, 'children'>;
|
|
@@ -1955,7 +1971,7 @@ declare const useSlateProps: ({
|
|
|
1955
1971
|
}) => PlateSlateProps;
|
|
1956
1972
|
//#endregion
|
|
1957
1973
|
//#region src/react/utils/createPlateFallbackEditor.d.ts
|
|
1958
|
-
declare const createPlateFallbackEditor: (options?: CreatePlateEditorOptions) => TPlateEditor<
|
|
1974
|
+
declare const createPlateFallbackEditor: (options?: CreatePlateEditorOptions) => TPlateEditor<_platejs_slate19.Value, PlateCorePlugin>;
|
|
1959
1975
|
//#endregion
|
|
1960
1976
|
//#region src/react/utils/dom-attributes.d.ts
|
|
1961
1977
|
declare const DOM_HANDLERS: (keyof DOMHandlers)[];
|
|
@@ -2052,4 +2068,4 @@ type RenderText = (props: PlateTextProps) => React$1.ReactElement<any>;
|
|
|
2052
2068
|
*/
|
|
2053
2069
|
declare const pluginRenderText: (editor: PlateEditor, plugin: AnyEditorPlatePlugin) => RenderText;
|
|
2054
2070
|
//#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 };
|
|
2071
|
+
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, NavigationFeedbackPlugin, 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, useNavigationHighlight, 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 };
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as BaseParagraphPlugin, at as DOMPlugin, cn as createSlatePlugin, lt as ChunkingPlugin, n as withSlate, p as isEditOnly, s as SlateExtensionPlugin, sn as getEditorPlugin$1, tn as getPluginByType, vt as getSlateClass, y as NavigationFeedbackPlugin$1, yt as getPluginNodeProps } from "../withSlate-DsAgt7dN.js";
|
|
2
2
|
import { t as Hotkeys } from "../hotkeys-DI1HPO2Q.js";
|
|
3
|
-
import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-
|
|
3
|
+
import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-HrbPXDQ1.js";
|
|
4
4
|
import { PathApi, createEditor } from "@platejs/slate";
|
|
5
5
|
import { isDefined } from "@udecode/utils";
|
|
6
6
|
import { DefaultPlaceholder, Editable, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
|
|
@@ -269,6 +269,44 @@ const useFocusedLast = (id) => {
|
|
|
269
269
|
return (id ?? useEditorId()) === useEventEditorValue("last");
|
|
270
270
|
};
|
|
271
271
|
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/react/plugins/navigation-feedback/useNavigationHighlight.ts
|
|
274
|
+
const useNavigationHighlight = (target) => {
|
|
275
|
+
const targetRef = React.useRef(target);
|
|
276
|
+
targetRef.current = target;
|
|
277
|
+
return useEditorSelector((editor) => {
|
|
278
|
+
const activeTarget = editor.api.navigation.activeTarget();
|
|
279
|
+
if (!activeTarget) return null;
|
|
280
|
+
const currentTarget = targetRef.current;
|
|
281
|
+
if (!currentTarget) return null;
|
|
282
|
+
const resolvedPath = Array.isArray(currentTarget) ? currentTarget : editor.api.findPath(currentTarget);
|
|
283
|
+
if (!resolvedPath) return null;
|
|
284
|
+
if (!PathApi.equals(activeTarget.path, resolvedPath)) return null;
|
|
285
|
+
return activeTarget;
|
|
286
|
+
}, [target]);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/react/plugins/navigation-feedback/NavigationFeedbackPlugin.ts
|
|
291
|
+
const NavigationFeedbackPlugin = toTPlatePlugin(NavigationFeedbackPlugin$1, { inject: {
|
|
292
|
+
isElement: true,
|
|
293
|
+
nodeProps: { transformProps: ({ element, props, text }) => {
|
|
294
|
+
const activeTarget = useNavigationHighlight(element ?? text);
|
|
295
|
+
if (!activeTarget) return props;
|
|
296
|
+
return {
|
|
297
|
+
...props,
|
|
298
|
+
"data-nav-cycle": String(activeTarget.cycle),
|
|
299
|
+
"data-nav-highlight": activeTarget.variant,
|
|
300
|
+
"data-nav-pulse": String(activeTarget.pulse),
|
|
301
|
+
"data-nav-target": "true",
|
|
302
|
+
style: {
|
|
303
|
+
...props.style ?? {},
|
|
304
|
+
"--plate-nav-feedback-duration": `${activeTarget.duration}ms`
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
} }
|
|
308
|
+
} });
|
|
309
|
+
|
|
272
310
|
//#endregion
|
|
273
311
|
//#region src/react/plugins/paragraph/ParagraphPlugin.tsx
|
|
274
312
|
const ParagraphPlugin = toPlatePlugin(BaseParagraphPlugin, ({ editor, type }) => ({ shortcuts: { toggleParagraph: {
|
|
@@ -301,10 +339,14 @@ const ReactPlugin = toPlatePlugin(DOMPlugin, {
|
|
|
301
339
|
|
|
302
340
|
//#endregion
|
|
303
341
|
//#region src/react/editor/getPlateCorePlugins.ts
|
|
304
|
-
const getPlateCorePlugins = () => [
|
|
342
|
+
const getPlateCorePlugins = ({ navigationFeedback } = {}) => [
|
|
305
343
|
SlateReactExtensionPlugin,
|
|
306
344
|
ReactPlugin,
|
|
307
345
|
EventEditorPlugin,
|
|
346
|
+
NavigationFeedbackPlugin.configure({
|
|
347
|
+
enabled: navigationFeedback !== false,
|
|
348
|
+
options: typeof navigationFeedback === "boolean" ? void 0 : navigationFeedback
|
|
349
|
+
}),
|
|
308
350
|
ParagraphPlugin
|
|
309
351
|
];
|
|
310
352
|
|
|
@@ -321,11 +363,12 @@ const getPlateCorePlugins = () => [
|
|
|
321
363
|
* @see {@link withSlate} for the non-React version of editor enhancement.
|
|
322
364
|
*/
|
|
323
365
|
const withPlate = (e, options = {}) => {
|
|
324
|
-
const { optionsStoreFactory, plugins = [], ...rest } = options;
|
|
366
|
+
const { navigationFeedback, optionsStoreFactory, plugins = [], ...rest } = options;
|
|
325
367
|
return withSlate(e, {
|
|
368
|
+
navigationFeedback,
|
|
326
369
|
...rest,
|
|
327
370
|
optionsStoreFactory: optionsStoreFactory ?? createZustandStore,
|
|
328
|
-
plugins: [...getPlateCorePlugins(), ...plugins]
|
|
371
|
+
plugins: [...getPlateCorePlugins({ navigationFeedback }), ...plugins]
|
|
329
372
|
});
|
|
330
373
|
};
|
|
331
374
|
/**
|
|
@@ -2578,4 +2621,4 @@ const withHOC = (HOC, Component, hocProps, hocRef) => React.forwardRef((props, c
|
|
|
2578
2621
|
});
|
|
2579
2622
|
|
|
2580
2623
|
//#endregion
|
|
2581
|
-
export { BLUR_EDITOR_EVENT, BelowRootNodes, ContentVisibilityChunk, DOM_HANDLERS, DefaultPlaceholder, Editable, EditorHotkeysEffect, EditorMethodsEffect, EditorRefEffect, EditorRefPluginEffect, ElementProvider, EventEditorPlugin, EventEditorStore, FOCUS_EDITOR_EVENT, GLOBAL_PLATE_SCOPE, PLATE_SCOPE, ParagraphPlugin, Plate, PlateContainer, PlateContent, PlateController, PlateControllerEffect, PlateElement, PlateLeaf, PlateSlate, PlateStoreProvider, PlateTest, PlateText, PlateView, ReactPlugin, SCOPE_ELEMENT, Slate, SlateReactExtensionPlugin, 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 };
|
|
2624
|
+
export { BLUR_EDITOR_EVENT, BelowRootNodes, ContentVisibilityChunk, DOM_HANDLERS, DefaultPlaceholder, Editable, EditorHotkeysEffect, EditorMethodsEffect, EditorRefEffect, EditorRefPluginEffect, ElementProvider, EventEditorPlugin, EventEditorStore, FOCUS_EDITOR_EVENT, GLOBAL_PLATE_SCOPE, NavigationFeedbackPlugin, PLATE_SCOPE, ParagraphPlugin, Plate, PlateContainer, PlateContent, PlateController, PlateControllerEffect, PlateElement, PlateLeaf, PlateSlate, PlateStoreProvider, PlateTest, PlateText, PlateView, ReactPlugin, SCOPE_ELEMENT, Slate, SlateReactExtensionPlugin, 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, useNavigationHighlight, 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 };
|
package/dist/static/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $a as SlateHTMLProps, Ba as getSelectedDomNode, Co as SlateRenderLeaf, Do as SlateRenderElement, Eo as pipeRenderElementStatic, Ga as getPluginDataAttributes, Ha as getSelectedDomBlocks, Ia as stripSlateDataAttributes, Ja as ViewPlugin, Ka as createStaticString, La as stripHtmlClassNames, Oo as pluginRenderElementStatic, Qa as SlateElementProps, Ra as pipeDecorate, So as pluginRenderTextStatic, To as pluginRenderLeafStatic, Ua as getRenderNodeStaticProps, Va as getSelectedDomFragment, Wa as getNodeDataAttributes, Xa as getEditorDOMFromHtmlString, Ya as createStaticEditor, Za as SlateElement, _o as LeafStatic, ao as StyledSlateElementProps, bo as SlateRenderText, co as useNodeAttributes, do as SlateRenderLeafProps, eo as SlateLeaf, fo as SlateRenderNodeProps, go as ElementStatic, ho as serializeHtml, io as SlateTextProps, lo as BoxStaticProps, mo as SerializeHtmlOptions, no as SlateNodeProps, oo as StyledSlateLeafProps, po as SlateRenderTextProps, qa as getStaticPlugins, ro as SlateText, so as StyledSlateTextProps, to as SlateLeafProps, uo as SlateRenderElementProps, vo as PlateStatic, wo as pipeRenderLeafStatic, xo as pipeRenderTextStatic, yo as PlateStaticProps, za as isSelectOutside } from "../index-DRweaH9Q";
|
|
2
2
|
export { BoxStaticProps, ElementStatic, LeafStatic, PlateStatic, PlateStaticProps, SerializeHtmlOptions, SlateElement, SlateElementProps, SlateHTMLProps, SlateLeaf, SlateLeafProps, SlateNodeProps, SlateRenderElement, SlateRenderElementProps, SlateRenderLeaf, SlateRenderLeafProps, SlateRenderNodeProps, SlateRenderText, SlateRenderTextProps, SlateText, SlateTextProps, StyledSlateElementProps, StyledSlateLeafProps, StyledSlateTextProps, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
|
package/dist/static/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../withSlate-
|
|
2
|
-
import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-
|
|
1
|
+
import "../withSlate-DsAgt7dN.js";
|
|
2
|
+
import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-HrbPXDQ1.js";
|
|
3
3
|
|
|
4
4
|
export { ElementStatic, LeafStatic, PlateStatic, SlateElement, SlateLeaf, SlateText, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as getInjectMatch, at as DOMPlugin, n as withSlate, p as isEditOnly, sn as getEditorPlugin, tn as getPluginByType, vt as getSlateClass, xt as keyToDataAttribute, yt as getPluginNodeProps } from "./withSlate-DsAgt7dN.js";
|
|
2
2
|
import { ElementApi, NodeApi, RangeApi, TextApi, createEditor, isElementDecorationsEqual, isTextDecorationsEqual } from "@platejs/slate";
|
|
3
3
|
import { isDefined } from "@udecode/utils";
|
|
4
4
|
import React from "react";
|
|
@@ -20,7 +20,7 @@ const pluginInjectNodeProps = (editor, plugin, nodeProps, getElementPath) => {
|
|
|
20
20
|
if (!node) return;
|
|
21
21
|
if (!injectNodeProps) return;
|
|
22
22
|
const { classNames, defaultNodeValue, nodeKey = editor.getType(key), query, styleKey = nodeKey, transformClassName, transformNodeValue, transformProps, transformStyle, validNodeValues } = injectNodeProps;
|
|
23
|
-
if (!getInjectMatch(editor, plugin)(node, getElementPath(node))) return;
|
|
23
|
+
if (!getInjectMatch(editor, plugin)(node, !!(plugin.inject.excludeBelowPlugins || plugin.inject.maxLevel) ? getElementPath(node) : void 0)) return;
|
|
24
24
|
const queryResult = query?.({
|
|
25
25
|
...injectNodeProps,
|
|
26
26
|
...getEditorPlugin(editor, plugin),
|