@lofcz/platejs-core 52.3.6 → 53.0.0
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-C-LKDYK-.d.ts} +504 -54
- 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 +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _platejs_slate1 from "@platejs/slate";
|
|
2
|
-
import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate";
|
|
2
|
+
import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, InsertTextOptions, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, PathRef, Point, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate";
|
|
3
3
|
import { nanoid as nanoid$1 } from "nanoid";
|
|
4
4
|
import { AnyObject, Deep2Partial, Modify, Nullable, OmitFirst, UnionToIntersection, UnknownObject } from "@udecode/utils";
|
|
5
5
|
import { createVanillaStore, createVanillaStore as createZustandStore$1 } from "zustand-x/vanilla";
|
|
@@ -301,6 +301,197 @@ declare const stripHtmlClassNames: (html: string, {
|
|
|
301
301
|
//#region src/static/utils/stripSlateDataAttributes.d.ts
|
|
302
302
|
declare const stripSlateDataAttributes: (rawHtml: string) => string;
|
|
303
303
|
//#endregion
|
|
304
|
+
//#region src/lib/plugins/input-rules/types.d.ts
|
|
305
|
+
type InputRuleTarget = 'insertBreak' | 'insertData' | 'insertText';
|
|
306
|
+
type BivariantCallback$1<TArgs extends unknown[], TResult> = {
|
|
307
|
+
bivarianceHack: (...args: TArgs) => TResult;
|
|
308
|
+
}['bivarianceHack'];
|
|
309
|
+
type SelectionInputRuleContext<TEditor extends SlateEditor = SlateEditor> = {
|
|
310
|
+
editor: TEditor;
|
|
311
|
+
getBlockEntry: () => NodeEntry | undefined;
|
|
312
|
+
getBlockStartRange: () => TRange | undefined;
|
|
313
|
+
getBlockStartText: () => string | undefined;
|
|
314
|
+
getBlockTextBeforeSelection: () => string;
|
|
315
|
+
getCharAfter: () => string | undefined;
|
|
316
|
+
getCharBefore: () => string | undefined;
|
|
317
|
+
isCollapsed: boolean;
|
|
318
|
+
pluginKey: string;
|
|
319
|
+
};
|
|
320
|
+
type InsertBreakInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
321
|
+
cause: 'insertBreak';
|
|
322
|
+
insertBreak: () => void;
|
|
323
|
+
};
|
|
324
|
+
type InsertDataInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
325
|
+
cause: 'insertData';
|
|
326
|
+
data: DataTransfer;
|
|
327
|
+
insertData: (data: DataTransfer) => void;
|
|
328
|
+
text: string | null;
|
|
329
|
+
};
|
|
330
|
+
type InsertTextInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
331
|
+
cause: 'insertText';
|
|
332
|
+
insertText: (text: string, options?: InsertTextOptions) => void;
|
|
333
|
+
options?: InsertTextOptions;
|
|
334
|
+
text: string;
|
|
335
|
+
};
|
|
336
|
+
type BaseInputRule<TContext extends SelectionInputRuleContext = SelectionInputRuleContext> = {
|
|
337
|
+
enabled?: BivariantCallback$1<[context: TContext], boolean>;
|
|
338
|
+
priority?: number;
|
|
339
|
+
};
|
|
340
|
+
type MarkInputRuleConfig = BaseInputRule<InsertTextInputRuleContext> & {
|
|
341
|
+
end?: string;
|
|
342
|
+
mark?: string;
|
|
343
|
+
marks?: string[];
|
|
344
|
+
start: string;
|
|
345
|
+
trim?: 'allow' | 'reject';
|
|
346
|
+
trigger: string;
|
|
347
|
+
};
|
|
348
|
+
type BlockStartInputRuleMatch = {
|
|
349
|
+
range: TRange;
|
|
350
|
+
text: string;
|
|
351
|
+
};
|
|
352
|
+
type MatchBlockStartOptions<TMatch extends object = {}, TContext extends SelectionInputRuleContext = SelectionInputRuleContext> = {
|
|
353
|
+
match: RegExp | string | ((context: TContext) => RegExp | string | undefined);
|
|
354
|
+
resolveMatch?: (args: {
|
|
355
|
+
match: RegExpMatchArray | string;
|
|
356
|
+
range: TRange;
|
|
357
|
+
text: string;
|
|
358
|
+
}) => TMatch | undefined;
|
|
359
|
+
};
|
|
360
|
+
type BlockStartInputRuleConfig<TMatch extends object = {}> = BaseInputRule<InsertTextInputRuleContext> & {
|
|
361
|
+
apply?: (context: InsertTextInputRuleContext, match: BlockStartInputRuleMatch & TMatch) => boolean | void;
|
|
362
|
+
mode?: 'set' | 'toggle' | 'wrap';
|
|
363
|
+
node?: string;
|
|
364
|
+
removeMatchedText?: boolean;
|
|
365
|
+
trigger: string;
|
|
366
|
+
} & MatchBlockStartOptions<TMatch, InsertTextInputRuleContext>;
|
|
367
|
+
type BlockFenceInputRuleMatch = BlockStartInputRuleMatch & {
|
|
368
|
+
path: Path;
|
|
369
|
+
};
|
|
370
|
+
type MatchBlockFenceOptions<TMatch = BlockFenceInputRuleMatch> = {
|
|
371
|
+
block?: string;
|
|
372
|
+
fence: string;
|
|
373
|
+
resolveMatch?: (args: {
|
|
374
|
+
fence: string;
|
|
375
|
+
path: Path;
|
|
376
|
+
range: TRange;
|
|
377
|
+
text: string;
|
|
378
|
+
}) => TMatch | undefined;
|
|
379
|
+
};
|
|
380
|
+
type BlockFenceInputRuleConfig<TMatch = BlockFenceInputRuleMatch> = BaseInputRule<SelectionInputRuleContext> & MatchBlockFenceOptions<TMatch> & {
|
|
381
|
+
apply: (context: SelectionInputRuleContext, match: TMatch) => boolean | void;
|
|
382
|
+
on: 'break' | 'match';
|
|
383
|
+
};
|
|
384
|
+
type DelimitedInlineInputRuleMatch = {
|
|
385
|
+
content: string;
|
|
386
|
+
deleteRange: TRange;
|
|
387
|
+
};
|
|
388
|
+
type MatchDelimitedInlineOptions = {
|
|
389
|
+
boundaryRe?: RegExp;
|
|
390
|
+
close?: string;
|
|
391
|
+
followRe?: RegExp;
|
|
392
|
+
open: string;
|
|
393
|
+
rejectRepeatedOpen?: boolean;
|
|
394
|
+
requireClosingDelimiter?: boolean;
|
|
395
|
+
trim?: 'allow' | 'reject';
|
|
396
|
+
};
|
|
397
|
+
type TextSubstitutionPattern = {
|
|
398
|
+
format: readonly [string, string] | string;
|
|
399
|
+
match: readonly string[] | string;
|
|
400
|
+
trigger?: readonly string[] | string;
|
|
401
|
+
};
|
|
402
|
+
type TextSubstitutionMatch = {
|
|
403
|
+
end: string;
|
|
404
|
+
pattern: TextSubstitutionPattern;
|
|
405
|
+
points: {
|
|
406
|
+
afterStartMatchPoint: Point | undefined;
|
|
407
|
+
beforeEndMatchPoint: Point;
|
|
408
|
+
beforeStartMatchPoint: Point | undefined;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
type TextSubstitutionInputRuleConfig = BaseInputRule<InsertTextInputRuleContext> & {
|
|
412
|
+
patterns: TextSubstitutionPattern[];
|
|
413
|
+
};
|
|
414
|
+
type InputRuleBuilder = {
|
|
415
|
+
blockFence: <TMatch = BlockFenceInputRuleMatch>(config: BlockFenceInputRuleConfig<TMatch>) => AnyInputRule<TMatch>;
|
|
416
|
+
blockStart: <TMatch extends object = {}>(config: BlockStartInputRuleConfig<TMatch>) => InsertTextInputRule<BlockStartInputRuleMatch & TMatch>;
|
|
417
|
+
insertBreak: <TMatch = true>(rule: InsertBreakInputRule<TMatch>) => InsertBreakInputRule<TMatch>;
|
|
418
|
+
insertData: <TMatch = true>(rule: InsertDataInputRule<TMatch>) => InsertDataInputRule<TMatch>;
|
|
419
|
+
insertText: <TMatch = true>(rule: InsertTextInputRule<TMatch>) => InsertTextInputRule<TMatch>;
|
|
420
|
+
mark: (config: MarkInputRuleConfig) => InsertTextInputRule<{
|
|
421
|
+
afterStartMatchPoint: Point;
|
|
422
|
+
beforeEndMatchPoint: Point;
|
|
423
|
+
beforeStartMatchPoint: Point;
|
|
424
|
+
end: string | undefined;
|
|
425
|
+
}>;
|
|
426
|
+
};
|
|
427
|
+
type InputRulesFactoryContext = {
|
|
428
|
+
rule: InputRuleBuilder;
|
|
429
|
+
};
|
|
430
|
+
type InsertBreakInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertBreakInputRuleContext<TEditor>> & {
|
|
431
|
+
apply: BivariantCallback$1<[context: InsertBreakInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
432
|
+
resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext<TEditor>], TMatch | undefined>;
|
|
433
|
+
target: 'insertBreak';
|
|
434
|
+
};
|
|
435
|
+
type InsertDataInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertDataInputRuleContext<TEditor>> & {
|
|
436
|
+
apply: BivariantCallback$1<[context: InsertDataInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
437
|
+
mimeTypes?: string[];
|
|
438
|
+
resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext<TEditor>], TMatch | undefined>;
|
|
439
|
+
target: 'insertData';
|
|
440
|
+
};
|
|
441
|
+
type InsertTextInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertTextInputRuleContext<TEditor>> & {
|
|
442
|
+
apply: BivariantCallback$1<[context: InsertTextInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
443
|
+
resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext<TEditor>], TMatch | undefined>;
|
|
444
|
+
target: 'insertText';
|
|
445
|
+
trigger: readonly string[] | string;
|
|
446
|
+
};
|
|
447
|
+
type AnyInputRule<TMatch = unknown, TEditor extends SlateEditor = SlateEditor> = InsertBreakInputRule<TMatch, TEditor> | InsertDataInputRule<TMatch, TEditor> | InsertTextInputRule<TMatch, TEditor>;
|
|
448
|
+
type StoredInsertBreakInputRule = BaseInputRule<InsertBreakInputRuleContext> & {
|
|
449
|
+
apply: BivariantCallback$1<[context: InsertBreakInputRuleContext, match: unknown], boolean | void>;
|
|
450
|
+
resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext], unknown>;
|
|
451
|
+
target: 'insertBreak';
|
|
452
|
+
};
|
|
453
|
+
type StoredInsertDataInputRule = BaseInputRule<InsertDataInputRuleContext> & {
|
|
454
|
+
apply: BivariantCallback$1<[context: InsertDataInputRuleContext, match: unknown], boolean | void>;
|
|
455
|
+
mimeTypes?: string[];
|
|
456
|
+
resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext], unknown>;
|
|
457
|
+
target: 'insertData';
|
|
458
|
+
};
|
|
459
|
+
type StoredInsertTextInputRule = BaseInputRule<InsertTextInputRuleContext> & {
|
|
460
|
+
apply: BivariantCallback$1<[context: InsertTextInputRuleContext, match: unknown], boolean | void>;
|
|
461
|
+
resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext], unknown>;
|
|
462
|
+
target: 'insertText';
|
|
463
|
+
trigger: readonly string[] | string;
|
|
464
|
+
};
|
|
465
|
+
type StoredInputRule = StoredInsertBreakInputRule | StoredInsertDataInputRule | StoredInsertTextInputRule;
|
|
466
|
+
type InputRulesDefinition = InputRulesConfig | ((ctx: InputRulesFactoryContext) => InputRulesConfig);
|
|
467
|
+
type InputRulesConfig = AnyInputRule<any, SlateEditor>[];
|
|
468
|
+
type ResolvedInputRule = StoredInputRule & {
|
|
469
|
+
id: string;
|
|
470
|
+
pluginKey: string;
|
|
471
|
+
priority: number;
|
|
472
|
+
ruleIndex: number;
|
|
473
|
+
pluginIndex: number;
|
|
474
|
+
};
|
|
475
|
+
type ResolvedInputRulesMeta = {
|
|
476
|
+
insertBreak: Extract<ResolvedInputRule, {
|
|
477
|
+
target: 'insertBreak';
|
|
478
|
+
}>[];
|
|
479
|
+
insertData: Extract<ResolvedInputRule, {
|
|
480
|
+
target: 'insertData';
|
|
481
|
+
}>[];
|
|
482
|
+
insertText: {
|
|
483
|
+
all: Extract<ResolvedInputRule, {
|
|
484
|
+
target: 'insertText';
|
|
485
|
+
}>[];
|
|
486
|
+
byTrigger: Record<string, Extract<ResolvedInputRule, {
|
|
487
|
+
target: 'insertText';
|
|
488
|
+
}>[]>;
|
|
489
|
+
};
|
|
490
|
+
plugins: Record<string, {
|
|
491
|
+
rules: ResolvedInputRule[];
|
|
492
|
+
}>;
|
|
493
|
+
};
|
|
494
|
+
//#endregion
|
|
304
495
|
//#region src/lib/plugin/SlatePlugin.d.ts
|
|
305
496
|
type AnyEditorPlugin = EditorPlugin<AnyPluginConfig>;
|
|
306
497
|
type AnySlatePlugin = SlatePlugin<AnyPluginConfig>;
|
|
@@ -531,6 +722,7 @@ type SlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nul
|
|
|
531
722
|
* method, an API method, or use a custom handler function.
|
|
532
723
|
*/
|
|
533
724
|
shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], SlateShortcut | null>>;
|
|
725
|
+
inputRules: InputRulesDefinition | InputRulesConfig;
|
|
534
726
|
};
|
|
535
727
|
type SlatePluginConfig$1<K$1 extends string = any, O = {}, A = {}, T = {}, S = {}, EO = {}, EA = {}, ET = {}, ES = {}> = Partial<Omit<SlatePlugin<PluginConfig<K$1, Partial<O>, A, T, S>>, keyof SlatePluginMethods | 'api' | 'node' | 'optionsStore' | 'transforms'> & {
|
|
536
728
|
api: EA;
|
|
@@ -685,6 +877,50 @@ declare const HistoryPlugin: SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>
|
|
|
685
877
|
//#region src/lib/plugins/ParserPlugin.d.ts
|
|
686
878
|
declare const ParserPlugin: SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>>;
|
|
687
879
|
//#endregion
|
|
880
|
+
//#region src/lib/plugins/dom/withScrolling.d.ts
|
|
881
|
+
type WithAutoScrollOptions = {
|
|
882
|
+
mode?: ScrollMode;
|
|
883
|
+
operations?: AutoScrollOperationsMap;
|
|
884
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
885
|
+
};
|
|
886
|
+
declare const withScrolling: (editor: SlateEditor, fn: () => void, options?: WithAutoScrollOptions) => void;
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/lib/plugins/dom/DOMPlugin.d.ts
|
|
889
|
+
declare const AUTO_SCROLL: WeakMap<SlateEditor, boolean>;
|
|
890
|
+
type AutoScrollOperationsMap = Partial<Record<Operation['type'], boolean>>;
|
|
891
|
+
type DomConfig = PluginConfig<'dom', {
|
|
892
|
+
/** Choose the first or last matching operation as the scroll target */
|
|
893
|
+
scrollMode?: ScrollMode;
|
|
894
|
+
/**
|
|
895
|
+
* Operations map; false to disable an operation, true or undefined to
|
|
896
|
+
* enable
|
|
897
|
+
*/
|
|
898
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
899
|
+
/** Options passed to scrollIntoView */
|
|
900
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
901
|
+
}>;
|
|
902
|
+
/** Mode for picking target op when multiple enabled */
|
|
903
|
+
type ScrollMode = 'first' | 'last';
|
|
904
|
+
/**
|
|
905
|
+
* Placeholder plugin for DOM interaction, that could be replaced with
|
|
906
|
+
* ReactPlugin.
|
|
907
|
+
*/
|
|
908
|
+
declare const DOMPlugin: SlatePlugin<PluginConfig<"dom", {
|
|
909
|
+
/** Choose the first or last matching operation as the scroll target */
|
|
910
|
+
scrollMode?: ScrollMode;
|
|
911
|
+
/**
|
|
912
|
+
* Operations map; false to disable an operation, true or undefined to
|
|
913
|
+
* enable
|
|
914
|
+
*/
|
|
915
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
916
|
+
/** Options passed to scrollIntoView */
|
|
917
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
918
|
+
}, {
|
|
919
|
+
isScrolling: () => boolean;
|
|
920
|
+
}, {
|
|
921
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
922
|
+
}, {}>>;
|
|
923
|
+
//#endregion
|
|
688
924
|
//#region src/lib/plugins/slate-extension/transforms/init.d.ts
|
|
689
925
|
type InitOptions = {
|
|
690
926
|
autoSelect?: boolean | 'end' | 'start';
|
|
@@ -729,6 +965,23 @@ declare const insertExitBreak: (editor: SlateEditor, {
|
|
|
729
965
|
reverse
|
|
730
966
|
}?: InsertExitBreakOptions) => true | undefined;
|
|
731
967
|
//#endregion
|
|
968
|
+
//#region src/lib/plugins/slate-extension/transforms/liftBlock.d.ts
|
|
969
|
+
type LiftBlockOptions = {
|
|
970
|
+
at?: EditorAboveOptions['at'];
|
|
971
|
+
match?: EditorAboveOptions['match'];
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* Lift the current block out of the nearest matching ancestor container.
|
|
975
|
+
*
|
|
976
|
+
* This unwraps only the current block and splits the ancestor around it when
|
|
977
|
+
* needed, so one keypress changes one structural level instead of exploding the
|
|
978
|
+
* whole container.
|
|
979
|
+
*/
|
|
980
|
+
declare const liftBlock: (editor: SlateEditor, {
|
|
981
|
+
at,
|
|
982
|
+
match
|
|
983
|
+
}?: LiftBlockOptions) => true | undefined;
|
|
984
|
+
//#endregion
|
|
732
985
|
//#region src/lib/plugins/slate-extension/transforms/resetBlock.d.ts
|
|
733
986
|
/**
|
|
734
987
|
* Reset the current block to a paragraph, removing all properties except the
|
|
@@ -763,6 +1016,7 @@ type SlateExtensionConfig = PluginConfig<'slateExtension', {
|
|
|
763
1016
|
}, {
|
|
764
1017
|
init: OmitFirst<typeof init>;
|
|
765
1018
|
insertExitBreak: OmitFirst<typeof insertExitBreak>;
|
|
1019
|
+
liftBlock: OmitFirst<typeof liftBlock>;
|
|
766
1020
|
resetBlock: OmitFirst<typeof resetBlock>;
|
|
767
1021
|
setValue: OmitFirst<typeof setValue>;
|
|
768
1022
|
}>;
|
|
@@ -786,6 +1040,7 @@ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
|
|
|
786
1040
|
}, {
|
|
787
1041
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
788
1042
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
1043
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
789
1044
|
resetBlock: ((args_0?: {
|
|
790
1045
|
at?: _platejs_slate1.Path;
|
|
791
1046
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
@@ -795,50 +1050,94 @@ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
|
|
|
795
1050
|
apply: <N$1 extends _platejs_slate1.TElement | TText>(operation: _platejs_slate1.Operation<N$1>) => void;
|
|
796
1051
|
}, {}>>;
|
|
797
1052
|
//#endregion
|
|
798
|
-
//#region src/lib/plugins/
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
scrollOptions?: ScrollIntoViewOptions;
|
|
1053
|
+
//#region src/lib/plugins/navigation-feedback/types.d.ts
|
|
1054
|
+
declare const NAVIGATION_FEEDBACK_KEY = "navigationFeedback";
|
|
1055
|
+
declare const NavigationFeedbackPluginKey: {
|
|
1056
|
+
readonly key: "navigationFeedback";
|
|
803
1057
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
type
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1058
|
+
type NavigationFeedbackTarget = {
|
|
1059
|
+
path: Path;
|
|
1060
|
+
type: 'node';
|
|
1061
|
+
};
|
|
1062
|
+
type NavigationFeedbackActiveTarget = NavigationFeedbackTarget & {
|
|
1063
|
+
cycle: 0 | 1;
|
|
1064
|
+
duration: number;
|
|
1065
|
+
pulse: number;
|
|
1066
|
+
variant: string;
|
|
1067
|
+
};
|
|
1068
|
+
type NavigationFeedbackStoredTarget = Omit<NavigationFeedbackActiveTarget, 'path'> & {
|
|
1069
|
+
pathRef: PathRef;
|
|
1070
|
+
};
|
|
1071
|
+
type NavigationFlashTargetOptions = {
|
|
1072
|
+
duration?: number;
|
|
1073
|
+
target: NavigationFeedbackTarget;
|
|
1074
|
+
variant?: string;
|
|
1075
|
+
};
|
|
1076
|
+
type NavigationNavigateOptions = {
|
|
1077
|
+
flash?: false | {
|
|
1078
|
+
duration?: number;
|
|
1079
|
+
variant?: string;
|
|
1080
|
+
};
|
|
1081
|
+
focus?: boolean;
|
|
1082
|
+
scroll?: boolean;
|
|
1083
|
+
scrollTarget?: Point;
|
|
1084
|
+
select?: Point | TRange;
|
|
1085
|
+
target: NavigationFeedbackTarget;
|
|
1086
|
+
};
|
|
1087
|
+
type NavigationFeedbackConfig = PluginConfig<typeof NAVIGATION_FEEDBACK_KEY, {
|
|
1088
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1089
|
+
duration: number;
|
|
1090
|
+
}, {
|
|
1091
|
+
navigation: {
|
|
1092
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1093
|
+
clear: () => void;
|
|
1094
|
+
isTarget: (path: Path) => boolean;
|
|
1095
|
+
};
|
|
1096
|
+
}, {
|
|
1097
|
+
navigation: {
|
|
1098
|
+
clear: () => void;
|
|
1099
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1100
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1101
|
+
};
|
|
819
1102
|
}>;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
*/
|
|
826
|
-
declare const DOMPlugin: SlatePlugin<PluginConfig<"dom", {
|
|
827
|
-
/** Choose the first or last matching operation as the scroll target */
|
|
828
|
-
scrollMode?: ScrollMode;
|
|
829
|
-
/**
|
|
830
|
-
* Operations map; false to disable an operation, true or undefined to
|
|
831
|
-
* enable
|
|
832
|
-
*/
|
|
833
|
-
scrollOperations?: AutoScrollOperationsMap;
|
|
834
|
-
/** Options passed to scrollIntoView */
|
|
835
|
-
scrollOptions?: ScrollIntoViewOptions;
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/lib/plugins/navigation-feedback/NavigationFeedbackPlugin.d.ts
|
|
1105
|
+
declare const NavigationFeedbackPlugin: SlatePlugin<PluginConfig<"navigationFeedback", {
|
|
1106
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1107
|
+
duration: number;
|
|
836
1108
|
}, {
|
|
837
|
-
|
|
1109
|
+
navigation: {
|
|
1110
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1111
|
+
clear: () => void;
|
|
1112
|
+
isTarget: (path: _platejs_slate1.Path) => boolean;
|
|
1113
|
+
};
|
|
838
1114
|
}, {
|
|
839
|
-
|
|
1115
|
+
navigation: {
|
|
1116
|
+
clear: () => void;
|
|
1117
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1118
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1119
|
+
};
|
|
840
1120
|
}, {}>>;
|
|
841
1121
|
//#endregion
|
|
1122
|
+
//#region src/lib/plugins/navigation-feedback/transforms/flashTarget.d.ts
|
|
1123
|
+
declare const resolveNavigationFeedbackTarget: (target?: NavigationFeedbackStoredTarget | null) => NavigationFeedbackActiveTarget | null;
|
|
1124
|
+
declare const clearNavigationFeedbackTarget: (editor: SlateEditor, pulse?: number) => boolean;
|
|
1125
|
+
declare const flashTarget: (editor: SlateEditor, {
|
|
1126
|
+
duration,
|
|
1127
|
+
target,
|
|
1128
|
+
variant
|
|
1129
|
+
}: NavigationFlashTargetOptions) => boolean;
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region src/lib/plugins/navigation-feedback/transforms/navigate.d.ts
|
|
1132
|
+
declare const navigate: (editor: SlateEditor, {
|
|
1133
|
+
flash,
|
|
1134
|
+
focus,
|
|
1135
|
+
scroll,
|
|
1136
|
+
scrollTarget,
|
|
1137
|
+
select,
|
|
1138
|
+
target
|
|
1139
|
+
}: NavigationNavigateOptions) => boolean;
|
|
1140
|
+
//#endregion
|
|
842
1141
|
//#region src/lib/plugins/affinity/AffinityPlugin.d.ts
|
|
843
1142
|
type ElementAffinity = {
|
|
844
1143
|
affinity: 'backward' | 'forward';
|
|
@@ -1040,6 +1339,8 @@ type GetCorePluginsOptions = {
|
|
|
1040
1339
|
chunking?: ChunkingConfig['options'] | boolean;
|
|
1041
1340
|
/** Specifies the maximum number of characters allowed in the editor. */
|
|
1042
1341
|
maxLength?: number;
|
|
1342
|
+
/** Configure the navigation feedback plugin. */
|
|
1343
|
+
navigationFeedback?: NavigationFeedbackConfig['options'] | boolean;
|
|
1043
1344
|
/** Configure the node id plugin. */
|
|
1044
1345
|
nodeId?: NodeIdConfig['options'] | boolean;
|
|
1045
1346
|
/** Override the core plugins using the same key. */
|
|
@@ -1049,9 +1350,18 @@ declare const getCorePlugins: ({
|
|
|
1049
1350
|
affinity,
|
|
1050
1351
|
chunking,
|
|
1051
1352
|
maxLength,
|
|
1353
|
+
navigationFeedback,
|
|
1052
1354
|
nodeId,
|
|
1053
1355
|
plugins
|
|
1054
|
-
}: GetCorePluginsOptions) => (SlatePlugin<
|
|
1356
|
+
}: GetCorePluginsOptions) => (SlatePlugin<PluginConfig<"dom", {
|
|
1357
|
+
scrollMode?: ScrollMode;
|
|
1358
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
1359
|
+
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
1360
|
+
}, {
|
|
1361
|
+
isScrolling: () => boolean;
|
|
1362
|
+
}, {
|
|
1363
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
1364
|
+
}, {}>> | SlatePlugin<DebugConfig> | SlatePlugin<PluginConfig<"slateExtension", {
|
|
1055
1365
|
onNodeChange: (options: {
|
|
1056
1366
|
editor: SlateEditor;
|
|
1057
1367
|
node: _platejs_slate1.Descendant;
|
|
@@ -1070,6 +1380,7 @@ declare const getCorePlugins: ({
|
|
|
1070
1380
|
}, {
|
|
1071
1381
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
1072
1382
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
1383
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
1073
1384
|
resetBlock: ((args_0?: {
|
|
1074
1385
|
at?: _platejs_slate1.Path;
|
|
1075
1386
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
@@ -1077,15 +1388,22 @@ declare const getCorePlugins: ({
|
|
|
1077
1388
|
} | undefined) => true | undefined);
|
|
1078
1389
|
setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void);
|
|
1079
1390
|
apply: <N$1 extends _platejs_slate1.TElement | _platejs_slate1.TText>(operation: _platejs_slate1.Operation<N$1>) => void;
|
|
1080
|
-
}, {}>> | SlatePlugin<PluginConfig<"
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
1391
|
+
}, {}>> | SlatePlugin<PluginConfig<"navigationFeedback", {
|
|
1392
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1393
|
+
duration: number;
|
|
1084
1394
|
}, {
|
|
1085
|
-
|
|
1395
|
+
navigation: {
|
|
1396
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1397
|
+
clear: () => void;
|
|
1398
|
+
isTarget: (path: _platejs_slate1.Path) => boolean;
|
|
1399
|
+
};
|
|
1086
1400
|
}, {
|
|
1087
|
-
|
|
1088
|
-
|
|
1401
|
+
navigation: {
|
|
1402
|
+
clear: () => void;
|
|
1403
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1404
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1405
|
+
};
|
|
1406
|
+
}, {}>> | SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>> | SlatePlugin<PluginConfig> | SlatePlugin<PluginConfig<"override", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>> | SlatePlugin<LengthConfig> | SlatePlugin<PluginConfig<"html", {}, Record<"html", {
|
|
1089
1407
|
deserialize: (args_0: {
|
|
1090
1408
|
element: HTMLElement | string;
|
|
1091
1409
|
collapseWhiteSpace?: boolean;
|
|
@@ -1106,8 +1424,8 @@ declare const getCorePlugins: ({
|
|
|
1106
1424
|
} & Record<"nodeId", {
|
|
1107
1425
|
normalize(): void;
|
|
1108
1426
|
}>, {}>> | SlatePlugin<AffinityConfig> | SlatePlugin<PluginConfig<"p", {}, {}, {}, {}>> | SlatePlugin<ChunkingConfig>)[];
|
|
1109
|
-
type CorePluginTransforms = SlateExtensionConfig['transforms'];
|
|
1110
|
-
type CorePluginApi = SlateExtensionConfig['api'];
|
|
1427
|
+
type CorePluginTransforms = SlateExtensionConfig['transforms'] & NavigationFeedbackConfig['transforms'];
|
|
1428
|
+
type CorePluginApi = SlateExtensionConfig['api'] & NavigationFeedbackConfig['api'];
|
|
1111
1429
|
type DebugConfig = PluginConfig<'debug', {
|
|
1112
1430
|
isProduction: boolean;
|
|
1113
1431
|
logger: Partial<Record<LogLevel, LogFunction>>;
|
|
@@ -1473,6 +1791,124 @@ declare const isLastNonEmptyTextOfInlineFormattingContext: (initialText: Text) =
|
|
|
1473
1791
|
declare const upsertInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
|
|
1474
1792
|
declare const endInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
|
|
1475
1793
|
//#endregion
|
|
1794
|
+
//#region src/lib/plugins/input-rules/createInputRules.d.ts
|
|
1795
|
+
declare const createMarkInputRule: (config: MarkInputRuleConfig) => ReturnType<InputRuleBuilder["mark"]>;
|
|
1796
|
+
declare const matchBlockStart: <TMatch extends object = {}, TContext extends SelectionInputRuleContext = SelectionInputRuleContext>(context: TContext, config: MatchBlockStartOptions<TMatch, TContext>) => (BlockStartInputRuleMatch & TMatch) | undefined;
|
|
1797
|
+
declare const createBlockStartInputRule: <TMatch extends object = {}>(config: BlockStartInputRuleConfig<TMatch>) => InsertTextInputRule<BlockStartInputRuleMatch & TMatch, SlateEditor>;
|
|
1798
|
+
declare const matchBlockFence: <TMatch = BlockFenceInputRuleMatch, TContext extends SelectionInputRuleContext = SelectionInputRuleContext>(context: TContext, config: MatchBlockFenceOptions<TMatch>) => TMatch | undefined;
|
|
1799
|
+
declare function createBlockFenceInputRule<TMatch = BlockFenceInputRuleMatch>(config: BlockFenceInputRuleConfig<TMatch>): InsertBreakInputRule<TMatch, SlateEditor> | InsertTextInputRule<TMatch, SlateEditor>;
|
|
1800
|
+
declare const matchDelimitedInline: (context: SelectionInputRuleContext, {
|
|
1801
|
+
boundaryRe,
|
|
1802
|
+
close,
|
|
1803
|
+
followRe,
|
|
1804
|
+
open,
|
|
1805
|
+
requireClosingDelimiter,
|
|
1806
|
+
rejectRepeatedOpen,
|
|
1807
|
+
trim
|
|
1808
|
+
}: MatchDelimitedInlineOptions) => DelimitedInlineInputRuleMatch | undefined;
|
|
1809
|
+
declare const createTextSubstitutionInputRule: ({
|
|
1810
|
+
enabled,
|
|
1811
|
+
patterns,
|
|
1812
|
+
priority
|
|
1813
|
+
}: TextSubstitutionInputRuleConfig) => InsertTextInputRule<TextSubstitutionMatch, SlateEditor>;
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/lib/plugins/input-rules/createRuleFactory.d.ts
|
|
1816
|
+
type FactoryValue<TInput, TValue> = TValue | ((input: TInput) => TValue);
|
|
1817
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
1818
|
+
type BivariantCallback<T extends (...args: never[]) => unknown> = {
|
|
1819
|
+
bivarianceHack: T;
|
|
1820
|
+
}['bivarianceHack'];
|
|
1821
|
+
type RuntimeOptions<TContext> = {
|
|
1822
|
+
enabled?: (context: TContext) => boolean;
|
|
1823
|
+
priority?: number;
|
|
1824
|
+
};
|
|
1825
|
+
type FactoryInput<TContext, TDefaults extends object, TRequired extends object> = TContext & TDefaults & TRequired;
|
|
1826
|
+
type PublicOptions<TContext, TDefaults extends object, TRequired extends object> = Simplify<Partial<TDefaults> & TRequired & RuntimeOptions<TContext>>;
|
|
1827
|
+
type CreateRuleFactoryReturn<TContext, TDefaults extends object, TRequired extends object> = keyof TRequired extends never ? (options?: PublicOptions<TContext, TDefaults, TRequired>) => AnyInputRule<unknown> : (options: PublicOptions<TContext, TDefaults, TRequired>) => AnyInputRule<unknown>;
|
|
1828
|
+
type RuleFactoryConfigBuilder<TContext, TDefaults extends object, TRequired extends object, TConfig> = (options: PublicOptions<TContext, TDefaults, TRequired>) => TConfig;
|
|
1829
|
+
type MarkRuleFactoryConfig<TDefaults extends object, TRequired extends object> = {
|
|
1830
|
+
type: 'mark';
|
|
1831
|
+
end?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1832
|
+
mark?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1833
|
+
marks?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string[] | undefined>;
|
|
1834
|
+
start: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1835
|
+
trim?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, MarkInputRuleConfig['trim']>;
|
|
1836
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1837
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1838
|
+
priority?: number;
|
|
1839
|
+
};
|
|
1840
|
+
type BlockStartRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch extends object = {}> = {
|
|
1841
|
+
type: 'blockStart';
|
|
1842
|
+
apply?: BivariantCallback<(input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, match: BlockStartInputRuleMatch & TMatch) => boolean | void>;
|
|
1843
|
+
match: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, RegExp | string | undefined>;
|
|
1844
|
+
mode?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, BlockStartInputRuleConfig<TMatch>['mode']>;
|
|
1845
|
+
node?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1846
|
+
removeMatchedText?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, boolean | undefined>;
|
|
1847
|
+
resolveMatch?: (args: {
|
|
1848
|
+
match: RegExpMatchArray | string;
|
|
1849
|
+
range: BlockStartInputRuleMatch['range'];
|
|
1850
|
+
text: string;
|
|
1851
|
+
}, input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1852
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1853
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1854
|
+
priority?: number;
|
|
1855
|
+
};
|
|
1856
|
+
type BlockFenceRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1857
|
+
type: 'blockFence';
|
|
1858
|
+
apply: BivariantCallback<(input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1859
|
+
block?: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1860
|
+
fence: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, string>;
|
|
1861
|
+
on?: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, BlockFenceInputRuleConfig<TMatch>['on']>;
|
|
1862
|
+
resolveMatch?: (args: {
|
|
1863
|
+
fence: string;
|
|
1864
|
+
path: BlockFenceInputRuleMatch['path'];
|
|
1865
|
+
range: BlockFenceInputRuleMatch['range'];
|
|
1866
|
+
text: string;
|
|
1867
|
+
}, input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1868
|
+
enabled?: (input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1869
|
+
priority?: number;
|
|
1870
|
+
};
|
|
1871
|
+
type InsertTextRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1872
|
+
type: 'insertText';
|
|
1873
|
+
apply: BivariantCallback<(input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1874
|
+
resolve?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1875
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, InsertTextInputRule<TMatch>['trigger']>;
|
|
1876
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1877
|
+
priority?: number;
|
|
1878
|
+
};
|
|
1879
|
+
type InsertBreakRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1880
|
+
type: 'insertBreak';
|
|
1881
|
+
apply: BivariantCallback<(input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1882
|
+
resolve?: (input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1883
|
+
enabled?: (input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1884
|
+
priority?: number;
|
|
1885
|
+
};
|
|
1886
|
+
type InsertDataRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1887
|
+
type: 'insertData';
|
|
1888
|
+
apply: BivariantCallback<(input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1889
|
+
mimeTypes?: FactoryValue<FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>, string[] | undefined>;
|
|
1890
|
+
resolve?: (input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1891
|
+
enabled?: (input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1892
|
+
priority?: number;
|
|
1893
|
+
};
|
|
1894
|
+
type TextSubstitutionRuleFactoryConfig<TDefaults extends object, TRequired extends object> = {
|
|
1895
|
+
type: 'textSubstitution';
|
|
1896
|
+
patterns: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, TextSubstitutionInputRuleConfig['patterns']>;
|
|
1897
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1898
|
+
priority?: number;
|
|
1899
|
+
};
|
|
1900
|
+
type AnyRuleFactoryConfig<TDefaults extends object = Record<string, unknown>, TRequired extends object = Record<string, unknown>, TMatch = unknown> = MarkRuleFactoryConfig<TDefaults, TRequired> | BlockStartRuleFactoryConfig<TDefaults, TRequired, TMatch extends object ? TMatch : {}> | BlockFenceRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertTextRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertBreakRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertDataRuleFactoryConfig<TDefaults, TRequired, TMatch> | TextSubstitutionRuleFactoryConfig<TDefaults, TRequired>;
|
|
1901
|
+
type AnyRuleFactoryConfigLoose<TDefaults extends object = Record<string, unknown>, TRequired extends object = Record<string, unknown>> = MarkRuleFactoryConfig<TDefaults, TRequired> | BlockStartRuleFactoryConfig<TDefaults, TRequired, {}> | BlockFenceRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertTextRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertBreakRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertDataRuleFactoryConfig<TDefaults, TRequired, unknown> | TextSubstitutionRuleFactoryConfig<TDefaults, TRequired>;
|
|
1902
|
+
type ContextFromFactoryConfig<TConfig> = TConfig extends MarkRuleFactoryConfig<any, any> | BlockStartRuleFactoryConfig<any, any, any> | InsertTextRuleFactoryConfig<any, any, any> | TextSubstitutionRuleFactoryConfig<any, any> ? InsertTextInputRuleContext : TConfig extends BlockFenceRuleFactoryConfig<any, any, any> ? SelectionInputRuleContext : TConfig extends InsertBreakRuleFactoryConfig<any, any, any> ? InsertBreakInputRuleContext : InsertDataInputRuleContext;
|
|
1903
|
+
declare function createRuleFactory<TRequired extends object = {}, TDefaults extends object = {}, TMatch = unknown, TConfig extends AnyRuleFactoryConfig<TDefaults, TRequired, TMatch> = AnyRuleFactoryConfig<TDefaults, TRequired, TMatch>>(config: TConfig & TDefaults): CreateRuleFactoryReturn<ContextFromFactoryConfig<TConfig>, TDefaults, TRequired>;
|
|
1904
|
+
declare function createRuleFactory<TRequired extends object = {}, TDefaults extends object = {}>(configBuilder: RuleFactoryConfigBuilder<SelectionInputRuleContext | InsertTextInputRuleContext | InsertBreakInputRuleContext | InsertDataInputRuleContext, TDefaults, TRequired, AnyRuleFactoryConfigLoose<TDefaults, TRequired>>): CreateRuleFactoryReturn<SelectionInputRuleContext | InsertTextInputRuleContext | InsertBreakInputRuleContext | InsertDataInputRuleContext, TDefaults, TRequired>;
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region src/lib/plugins/input-rules/defineInputRule.d.ts
|
|
1907
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertBreakInputRule<TMatch, TEditor>): InsertBreakInputRule<TMatch, TEditor>;
|
|
1908
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertDataInputRule<TMatch, TEditor>): InsertDataInputRule<TMatch, TEditor>;
|
|
1909
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertTextInputRule<TMatch, TEditor>): InsertTextInputRule<TMatch, TEditor>;
|
|
1910
|
+
declare function defineInputRule<TRule extends AnyInputRule>(rule: TRule): TRule;
|
|
1911
|
+
//#endregion
|
|
1476
1912
|
//#region src/lib/plugins/length/LengthPlugin.d.ts
|
|
1477
1913
|
declare const LengthPlugin: SlatePlugin<LengthConfig>;
|
|
1478
1914
|
//#endregion
|
|
@@ -1680,6 +2116,7 @@ type BasePlugin<C extends AnyPluginConfig = PluginConfig> = {
|
|
|
1680
2116
|
*
|
|
1681
2117
|
* - `'default'`: Default behavior
|
|
1682
2118
|
* - `'exit'`: Exit the current block
|
|
2119
|
+
* - `'lift'`: Lift the current block out of the nearest matching ancestor
|
|
1683
2120
|
* - `'reset'`: Reset block to default paragraph type
|
|
1684
2121
|
* - `'lineBreak'`: Insert newline character
|
|
1685
2122
|
* - `'deleteExit'`: Delete backward then exit
|
|
@@ -1689,6 +2126,7 @@ type BasePlugin<C extends AnyPluginConfig = PluginConfig> = {
|
|
|
1689
2126
|
* Defines actions on delete based on block state.
|
|
1690
2127
|
*
|
|
1691
2128
|
* - `'default'`: Default behavior
|
|
2129
|
+
* - `'lift'`: Lift the current block out of the nearest matching ancestor
|
|
1692
2130
|
* - `'reset'`: Reset block to default paragraph type
|
|
1693
2131
|
*/
|
|
1694
2132
|
delete?: DeleteRules;
|
|
@@ -1859,7 +2297,7 @@ type BaseTransformOptions = GetInjectNodePropsOptions & {
|
|
|
1859
2297
|
};
|
|
1860
2298
|
type BreakRules = {
|
|
1861
2299
|
/** Action when Enter is pressed in an empty block. */
|
|
1862
|
-
empty?: 'default' | 'deleteExit' | 'exit' | 'reset';
|
|
2300
|
+
empty?: 'default' | 'deleteExit' | 'exit' | 'lift' | 'reset';
|
|
1863
2301
|
/**
|
|
1864
2302
|
* Action when Enter is pressed at the end of an empty line. This is typically
|
|
1865
2303
|
* used with `default: 'lineBreak'`.
|
|
@@ -1900,7 +2338,7 @@ type DeleteRules = {
|
|
|
1900
2338
|
* </blockquote>
|
|
1901
2339
|
* ```
|
|
1902
2340
|
*/
|
|
1903
|
-
start?: 'default' | 'reset';
|
|
2341
|
+
start?: 'default' | 'lift' | 'reset';
|
|
1904
2342
|
/** Action when Backspace is pressed and the block is empty. */
|
|
1905
2343
|
empty?: 'default' | 'reset';
|
|
1906
2344
|
};
|
|
@@ -2097,6 +2535,7 @@ type SlateEditor = BaseEditor & {
|
|
|
2097
2535
|
meta: BaseEditor['meta'] & {
|
|
2098
2536
|
/** An array of plugins that are currently being used by the editor. */
|
|
2099
2537
|
pluginList: AnyEditorPlugin[];
|
|
2538
|
+
inputRules: ResolvedInputRulesMeta;
|
|
2100
2539
|
shortcuts: any;
|
|
2101
2540
|
};
|
|
2102
2541
|
plugins: Record<string, AnyEditorPlugin>;
|
|
@@ -2112,6 +2551,7 @@ type TSlateEditor<V extends Value = Value, P extends AnyPluginConfig = CorePlugi
|
|
|
2112
2551
|
api: EditorApi<V> & UnionToIntersection<InferApi<CorePlugin | P>>;
|
|
2113
2552
|
children: V;
|
|
2114
2553
|
meta: BaseEditor['meta'] & {
|
|
2554
|
+
inputRules: ResolvedInputRulesMeta;
|
|
2115
2555
|
pluginList: P[];
|
|
2116
2556
|
shortcuts: any;
|
|
2117
2557
|
};
|
|
@@ -2189,6 +2629,15 @@ type BaseWithSlateOptions<P extends AnyPluginConfig = CorePlugin> = {
|
|
|
2189
2629
|
* limit is reached, further input will be prevented.
|
|
2190
2630
|
*/
|
|
2191
2631
|
maxLength?: number;
|
|
2632
|
+
/**
|
|
2633
|
+
* Configuration for the built-in navigation feedback plugin.
|
|
2634
|
+
*
|
|
2635
|
+
* This core plugin flashes the landed target after navigation jumps such as
|
|
2636
|
+
* TOC, footnote, search, or custom outline movement.
|
|
2637
|
+
*
|
|
2638
|
+
* @default { duration: 1600 }
|
|
2639
|
+
*/
|
|
2640
|
+
navigationFeedback?: NavigationFeedbackConfig['options'] | boolean;
|
|
2192
2641
|
/**
|
|
2193
2642
|
* Configuration for automatic node ID generation and management.
|
|
2194
2643
|
*
|
|
@@ -2289,6 +2738,7 @@ declare const withSlate: <V extends Value = Value, P extends AnyPluginConfig = C
|
|
|
2289
2738
|
autoSelect,
|
|
2290
2739
|
chunking,
|
|
2291
2740
|
maxLength,
|
|
2741
|
+
navigationFeedback,
|
|
2292
2742
|
nodeId,
|
|
2293
2743
|
optionsStoreFactory,
|
|
2294
2744
|
plugins,
|
|
@@ -2482,7 +2932,7 @@ declare const getSlateElements: (element: HTMLElement) => HTMLElement[];
|
|
|
2482
2932
|
declare const defaultsDeepToNodes: <N$1 extends TNode>(options: Omit<ApplyDeepToNodesOptions<N$1>, "apply">) => void;
|
|
2483
2933
|
//#endregion
|
|
2484
2934
|
//#region src/lib/utils/getInjectMatch.d.ts
|
|
2485
|
-
declare const getInjectMatch: <E extends SlateEditor>(editor: E, plugin: EditorPlugin) => (node: TNode, path
|
|
2935
|
+
declare const getInjectMatch: <E extends SlateEditor>(editor: E, plugin: EditorPlugin) => (node: TNode, path?: Path) => boolean;
|
|
2486
2936
|
//#endregion
|
|
2487
2937
|
//#region src/lib/utils/getInjectedPlugins.d.ts
|
|
2488
2938
|
/**
|
|
@@ -2579,7 +3029,7 @@ declare const normalizeDescendantsToDocumentFragment: (editor: SlateEditor, {
|
|
|
2579
3029
|
}) => Descendant[];
|
|
2580
3030
|
//#endregion
|
|
2581
3031
|
//#region src/lib/utils/omitPluginContext.d.ts
|
|
2582
|
-
declare const omitPluginContext: <T extends SlatePluginContext<AnySlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "
|
|
3032
|
+
declare const omitPluginContext: <T extends SlatePluginContext<AnySlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "plugin" | "type" | "getOption" | "tf" | "getOptions" | "setOptions" | "setOption">;
|
|
2583
3033
|
//#endregion
|
|
2584
3034
|
//#region src/lib/utils/overridePluginsByKey.d.ts
|
|
2585
3035
|
/**
|
|
@@ -2598,4 +3048,4 @@ declare const pipeOnNodeChange: (editor: SlateEditor, node: Descendant, prevNode
|
|
|
2598
3048
|
//#region src/lib/utils/pipeOnTextChange.d.ts
|
|
2599
3049
|
declare const pipeOnTextChange: (editor: SlateEditor, node: Descendant, text: string, prevText: string, operation: TextOperation) => boolean;
|
|
2600
3050
|
//#endregion
|
|
2601
|
-
export { TSlateEditor as $,
|
|
3051
|
+
export { TSlateEditor as $, SlateHTMLProps as $a, Serializer as $i, cleanHtmlFontElements as $n, SlateExtensionConfig as $r, upsertInlineFormattingContext as $t, applyDeepToNodes as A, ResolvedInputRule as Aa, AnySlatePlugin as Ai, isHtmlInlineElement as An, AstPlugin as Ao, PlateError as Ar, BaseParagraphPlugin as At, ZustandStoreApi as B, getSelectedDomNode as Ba, InjectNodeProps as Bi, htmlBrToNewLine as Bn, navigate as Br, STATIC_VALUE_CREATED_AT as Bt, isSlateNode as C, InsertDataInputRuleContext as Ca, getPluginType as Ci, pipeDeserializeHtmlLeaf as Cn, SlateRenderLeaf as Co, NodeIdOptions as Cr, NodeComponents as Ct, isSlateText as D, MatchBlockFenceOptions as Da, createSlatePlugin as Di, isOlSymbol as Dn, SlateRenderElement as Do, DebugErrorType as Dr, SelectionRules as Dt, isSlateString as E, MarkInputRuleConfig as Ea, getEditorPlugin as Ei, parseHtmlDocument as En, pipeRenderElementStatic as Eo, normalizeNodeId as Er, PluginConfig as Et, RenderLeafProps as F, TextSubstitutionPattern as Fa, ExtendEditorApi as Fi, inlineTagNames as Fn, getEdgeNodes as Fr, withBreakRules as Ft, WithSlateOptions as G, getPluginDataAttributes as Ga, NodeStaticWrapperComponentReturnType as Gi, someHtmlElement as Gn, NAVIGATION_FEEDBACK_KEY as Gr, createBlockFenceInputRule as Gt, nanoid$1 as H, getSelectedDomBlocks as Ha, NodeStaticProps as Hi, getHtmlComments as Hn, flashTarget as Hr, LengthPlugin as Ht, RenderElementFn as I, stripSlateDataAttributes as Ia, ExtendEditorTransforms as Ii, htmlTextNodeToString as In, EdgeNodes as Ir, OverridePlugin as It, BaseEditor as J, ViewPlugin as Ja, Parser as Ji, deserializeHtmlElement as Jn, NavigationFeedbackPluginKey as Jr, createTextSubstitutionInputRule as Jt, createSlateEditor as K, createStaticString as Ka, NormalizeInitialValue as Ki, deserializeHtmlNodeChildren as Kn, NavigationFeedbackActiveTarget as Kr, createBlockStartInputRule as Kt, RenderElementProps as L, stripHtmlClassNames as La, HtmlDeserializer as Li, htmlStringToDOMNode as Ln, AffinityConfig as Lr, withOverrides as Lt, RenderTextFn as M, SelectionInputRuleContext as Ma, Deserializer as Mi, isHtmlElement as Mn, isNodeAffinity as Mr, withNormalizeRules as Mt, RenderTextProps as N, TextSubstitutionInputRuleConfig as Na, EditorPlugin as Ni, isHtmlComment as Nn, isNodesAffinity as Nr, withMergeRules as Nt, isSlateVoid as O, MatchBlockStartOptions as Oa, createTSlatePlugin as Oi, isHtmlText as On, pluginRenderElementStatic as Oo, DebugPlugin as Or, WithAnyKey as Ot, RenderLeafFn as P, TextSubstitutionMatch as Pa, ExtendEditor as Pi, isHtmlBlockElement as Pn, getMarkBoundaryAffinity as Pr, withDeleteRules as Pt, SlateEditor as Q, SlateElementProps as Qa, RenderStaticNodeWrapperProps as Qi, cleanHtmlLinkElements as Qn, NavigationNavigateOptions as Qr, endInlineFormattingContext as Qt, RenderChunkFn as R, pipeDecorate as Ra, HtmlSerializer as Ri, htmlElementToLeaf as Rn, AffinityPlugin as Rr, withNodeId as Rt, isSlateLeaf as S, InsertDataInputRule as Sa, getPluginKeys as Si, pluginDeserializeHtml as Sn, pluginRenderTextStatic as So, NodeIdConfig as Sr, NodeComponent as St, isSlatePluginNode as T, InsertTextInputRuleContext as Ta, getSlatePlugin as Ti, parseHtmlElement as Tn, pluginRenderLeafStatic as To, NormalizeNodeIdOptions as Tr, ParserOptions as Tt, BaseWithSlateOptions as U, getRenderNodeStaticProps as Ua, NodeStaticWrapperComponent as Ui, getDataNodeProps as Un, resolveNavigationFeedbackTarget as Ur, defineInputRule as Ut, createZustandStore$1 as V, getSelectedDomFragment as Va, LeafStaticProps as Vi, htmlBodyToFragment as Vn, clearNavigationFeedbackTarget as Vr, normalizeStaticValue as Vt, CreateSlateEditorOptions as W, getNodeDataAttributes as Wa, NodeStaticWrapperComponentProps as Wi, findHtmlElement as Wn, NavigationFeedbackPlugin as Wr, createRuleFactory as Wt, KeyofNodePlugins as X, getEditorDOMFromHtmlString as Xa, RenderStaticNodeWrapper as Xi, copyBlockMarksToSpanChild as Xn, NavigationFeedbackTarget as Xr, matchBlockStart as Xt, InferPlugins as Y, createStaticEditor as Ya, PartialEditorPlugin as Yi, deserializeHtml as Yn, NavigationFeedbackStoredTarget as Yr, matchBlockFence as Yt, KeyofPlugins as Z, SlateElement as Za, RenderStaticNodeWrapperFunction as Zi, cleanHtmlTextNodes as Zn, NavigationFlashTargetOptions as Zr, matchDelimitedInline as Zt, getInjectMatch as _, InputRulesConfig as _a, HistoryPlugin as _i, replaceTagName as _n, LeafStatic as _o, GetCorePluginsOptions as _r, InferOptions as _t, omitPluginContext as a, SlateShortcut as aa, InsertExitBreakOptions as ai, collapseWhiteSpaceChildren as an, StyledSlateElementProps as ao, CARRIAGE_RETURN as ar, BasePluginContext as at, isSlateEditor as b, InsertBreakInputRule as ba, getPluginByType as bi, preCleanHtml as bn, SlateRenderText as bo, ChunkingConfig as br, MatchRules as bt, isType as c, AnyInputRule as ca, init as ci, CollapseWhiteSpaceState as cn, useNodeAttributes as co, SPACE as cr, BaseTransformOptions as ct, isHotkey as d, BlockFenceInputRuleMatch as da, DOMPlugin as di, WhiteSpaceRule as dn, SlateRenderLeafProps as do, HtmlPlugin as dr, EditOnlyConfig as dt, SlatePlugin as ea, SlateExtensionPlugin as ei, isLastNonEmptyTextOfInlineFormattingContext as en, SlateLeaf as eo, cleanHtmlEmptyElements as er, AnyPluginConfig as et, getSlateClass as f, BlockStartInputRuleConfig as fa, DomConfig as fi, unwrapHtmlElement as fn, SlateRenderNodeProps as fo, withChunking as fr, ExtendConfig as ft, getInjectedPlugins as g, InputRuleTarget as ga, ParserPlugin as gi, traverseHtmlComments as gn, ElementStatic as go, DebugConfig as gr, InferKey as gt, keyToDataAttribute as h, InputRuleBuilder as ha, withScrolling as hi, traverseHtmlElements as hn, serializeHtml as ho, CorePluginTransforms as hr, InferApi as ht, overridePluginsByKey as i, SlatePlugins as ia, liftBlock as ii, collapseWhiteSpaceElement as in, SlateTextProps as io, DeserializeHtmlNodeReturnType as ir, BasePlugin as it, EditableProps as j, ResolvedInputRulesMeta as ja, Decorate as ji, isHtmlFragmentHref as jn, setAffinitySelection as jr, ParagraphConfig as jt, ApplyDeepToNodesOptions as k, MatchDelimitedInlineOptions as ka, AnyEditorPlugin as ki, isHtmlTable as kn, HandlerReturnType as ko, LogLevel as kr, WithRequiredKey as kt, Hotkeys as l, BaseInputRule as la, AUTO_SCROLL as li, TrimEndRule as ln, BoxStaticProps as lo, TAB as lr, BreakRules as lt, getNodeDataAttributeKeys as m, DelimitedInlineInputRuleMatch as ma, WithAutoScrollOptions as mi, traverseHtmlNode as mn, SerializeHtmlOptions as mo, CorePluginApi as mr, GetInjectNodePropsReturnType as mt, pipeOnNodeChange as n, SlatePluginContext as na, resetBlock as ni, collapseWhiteSpaceText as nn, SlateNodeProps as no, cleanHtmlBrElements as nr, BaseHtmlDeserializer as nt, normalizeDescendantsToDocumentFragment as o, TextStaticProps as oa, insertExitBreak as oi, collapseWhiteSpace as on, StyledSlateLeafProps as oo, LINE_FEED as or, BasePluginNode as ot, getPluginNodeProps as p, BlockStartInputRuleMatch as pa, ScrollMode as pi, traverseHtmlTexts as pn, SlateRenderTextProps as po, CorePlugin as pr, GetInjectNodePropsOptions as pt, withSlate as q, getStaticPlugins as qa, OverrideEditor as qi, deserializeHtmlNode as qn, NavigationFeedbackConfig as qr, createMarkInputRule as qt, pipeInsertDataQuery as r, SlatePluginMethods as ra, LiftBlockOptions as ri, collapseWhiteSpaceNode as rn, SlateText as ro, DeserializeHtmlChildren as rr, BaseInjectProps as rt, mergeDeepToNodes as s, TransformOptions as sa, InitOptions as si, collapseString as sn, StyledSlateTextProps as so, NO_BREAK_SPACE as sr, BaseSerializer as st, pipeOnTextChange as t, SlatePluginConfig$1 as ta, setValue as ti, inferWhiteSpaceRule as tn, SlateLeafProps as to, cleanHtmlCrLf as tr, BaseDeserializer as tt, createHotkey as u, BlockFenceInputRuleConfig as ua, AutoScrollOperationsMap as ui, TrimStartRule as un, SlateRenderElementProps as uo, ZERO_WIDTH_SPACE as ur, DeleteRules as ut, defaultsDeepToNodes as v, InputRulesDefinition as va, withPlateHistory as vi, removeHtmlSurroundings as vn, PlateStatic as vo, LengthConfig as vr, InferSelectors as vt, isSlatePluginElement as w, InsertTextInputRule as wa, getPluginTypes as wi, pipeDeserializeHtmlElement as wn, pipeRenderLeafStatic as wo, NodeIdPlugin as wr, NormalizeRules as wt, isSlateElement as x, InsertBreakInputRuleContext as xa, getPluginKey as xi, postCleanHtml as xn, pipeRenderTextStatic as xo, ChunkingPlugin as xr, MergeRules as xt, getSlateElements as y, InputRulesFactoryContext as ya, getContainerTypes as yi, removeHtmlNodesBetweenComments as yn, PlateStaticProps as yo, getCorePlugins as yr, InferTransforms as yt, RenderChunkProps as z, isSelectOutside as za, InferConfig as zi, htmlElementToElement as zn, ElementAffinity as zr, NormalizeStaticValueOptions as zt };
|