@prismicio/editor-fields 0.4.65 → 0.4.66

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.
@@ -105,6 +105,9 @@ interface OnAnalyticsEvent {
105
105
  error?: string;
106
106
  url?: string;
107
107
  }): void;
108
+ (event: "Table Limit Reached", args: {
109
+ type: "row" | "column";
110
+ }): void;
108
111
  }
109
112
  interface Analytics {
110
113
  onAnalyticsEvent?: OnAnalyticsEvent;
@@ -1453,9 +1453,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
1453
1453
  __TYPE__: "SeparatorContent";
1454
1454
  } | {
1455
1455
  __TYPE__: "TableContent";
1456
- content: {
1456
+ content: ({
1457
+ key: string;
1458
+ } & {
1457
1459
  type: "tableRow";
1458
1460
  content: ({
1461
+ key: string;
1462
+ } & {
1459
1463
  type: "tableCell" | "tableHeader";
1460
1464
  content: {
1461
1465
  __TYPE__: "StructuredTextContent";
@@ -1614,7 +1618,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
1614
1618
  } & {
1615
1619
  columnWidth?: number | undefined;
1616
1620
  })[];
1617
- }[];
1621
+ })[];
1618
1622
  } | {
1619
1623
  __TYPE__: "RepeatableContent";
1620
1624
  type: "Link";
@@ -2050,9 +2054,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
2050
2054
  __TYPE__: "SeparatorContent";
2051
2055
  } | {
2052
2056
  __TYPE__: "TableContent";
2053
- content: {
2057
+ content: ({
2058
+ key: string;
2059
+ } & {
2054
2060
  type: "tableRow";
2055
2061
  content: ({
2062
+ key: string;
2063
+ } & {
2056
2064
  type: "tableCell" | "tableHeader";
2057
2065
  content: {
2058
2066
  __TYPE__: "StructuredTextContent";
@@ -2211,7 +2219,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
2211
2219
  } & {
2212
2220
  columnWidth?: number | undefined;
2213
2221
  })[];
2214
- }[];
2222
+ })[];
2215
2223
  } | {
2216
2224
  __TYPE__: "RepeatableContent";
2217
2225
  type: "Link";
@@ -2639,9 +2647,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
2639
2647
  __TYPE__: "SeparatorContent";
2640
2648
  } | {
2641
2649
  __TYPE__: "TableContent";
2642
- content: {
2650
+ content: ({
2651
+ key: string;
2652
+ } & {
2643
2653
  type: "tableRow";
2644
2654
  content: ({
2655
+ key: string;
2656
+ } & {
2645
2657
  type: "tableCell" | "tableHeader";
2646
2658
  content: {
2647
2659
  __TYPE__: "StructuredTextContent";
@@ -2797,7 +2809,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
2797
2809
  } & {
2798
2810
  columnWidth?: number | undefined;
2799
2811
  })[];
2800
- }[];
2812
+ })[];
2801
2813
  } | {
2802
2814
  __TYPE__: "RepeatableContent";
2803
2815
  type: "Link";
@@ -3227,9 +3239,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
3227
3239
  __TYPE__: "SeparatorContent";
3228
3240
  } | {
3229
3241
  __TYPE__: "TableContent";
3230
- content: {
3242
+ content: ({
3243
+ key: string;
3244
+ } & {
3231
3245
  type: "tableRow";
3232
3246
  content: ({
3247
+ key: string;
3248
+ } & {
3233
3249
  type: "tableCell" | "tableHeader";
3234
3250
  content: {
3235
3251
  __TYPE__: "StructuredTextContent";
@@ -3388,7 +3404,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
3388
3404
  } & {
3389
3405
  columnWidth?: number | undefined;
3390
3406
  })[];
3391
- }[];
3407
+ })[];
3392
3408
  } | {
3393
3409
  __TYPE__: "RepeatableContent";
3394
3410
  type: "Link";
@@ -3816,9 +3832,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
3816
3832
  __TYPE__: "SeparatorContent";
3817
3833
  } | {
3818
3834
  __TYPE__: "TableContent";
3819
- content: {
3835
+ content: ({
3836
+ key: string;
3837
+ } & {
3820
3838
  type: "tableRow";
3821
3839
  content: ({
3840
+ key: string;
3841
+ } & {
3822
3842
  type: "tableCell" | "tableHeader";
3823
3843
  content: {
3824
3844
  __TYPE__: "StructuredTextContent";
@@ -3974,7 +3994,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
3974
3994
  } & {
3975
3995
  columnWidth?: number | undefined;
3976
3996
  })[];
3977
- }[];
3997
+ })[];
3978
3998
  } | {
3979
3999
  __TYPE__: "RepeatableContent";
3980
4000
  type: "Link";
@@ -4400,9 +4420,13 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
4400
4420
  __TYPE__: "SeparatorContent";
4401
4421
  } | {
4402
4422
  __TYPE__: "TableContent";
4403
- content: {
4423
+ content: ({
4424
+ key: string;
4425
+ } & {
4404
4426
  type: "tableRow";
4405
4427
  content: ({
4428
+ key: string;
4429
+ } & {
4406
4430
  type: "tableCell" | "tableHeader";
4407
4431
  content: {
4408
4432
  __TYPE__: "StructuredTextContent";
@@ -4561,7 +4585,7 @@ export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDe
4561
4585
  } & {
4562
4586
  columnWidth?: number | undefined;
4563
4587
  })[];
4564
- }[];
4588
+ })[];
4565
4589
  } | {
4566
4590
  __TYPE__: "RepeatableContent";
4567
4591
  type: "Link";
@@ -4996,9 +5020,13 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
4996
5020
  __TYPE__: "SeparatorContent";
4997
5021
  } | {
4998
5022
  __TYPE__: "TableContent";
4999
- content: {
5023
+ content: ({
5024
+ key: string;
5025
+ } & {
5000
5026
  type: "tableRow";
5001
5027
  content: ({
5028
+ key: string;
5029
+ } & {
5002
5030
  type: "tableCell" | "tableHeader";
5003
5031
  content: {
5004
5032
  __TYPE__: "StructuredTextContent";
@@ -5157,7 +5185,7 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
5157
5185
  } & {
5158
5186
  columnWidth?: number | undefined;
5159
5187
  })[];
5160
- }[];
5188
+ })[];
5161
5189
  } | {
5162
5190
  __TYPE__: "RepeatableContent";
5163
5191
  type: "Link";
@@ -5585,9 +5613,13 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
5585
5613
  __TYPE__: "SeparatorContent";
5586
5614
  } | {
5587
5615
  __TYPE__: "TableContent";
5588
- content: {
5616
+ content: ({
5617
+ key: string;
5618
+ } & {
5589
5619
  type: "tableRow";
5590
5620
  content: ({
5621
+ key: string;
5622
+ } & {
5591
5623
  type: "tableCell" | "tableHeader";
5592
5624
  content: {
5593
5625
  __TYPE__: "StructuredTextContent";
@@ -5746,7 +5778,7 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
5746
5778
  } & {
5747
5779
  columnWidth?: number | undefined;
5748
5780
  })[];
5749
- }[];
5781
+ })[];
5750
5782
  } | {
5751
5783
  __TYPE__: "RepeatableContent";
5752
5784
  type: "Link";
@@ -6176,9 +6208,13 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
6176
6208
  __TYPE__: "SeparatorContent";
6177
6209
  } | {
6178
6210
  __TYPE__: "TableContent";
6179
- content: {
6211
+ content: ({
6212
+ key: string;
6213
+ } & {
6180
6214
  type: "tableRow";
6181
6215
  content: ({
6216
+ key: string;
6217
+ } & {
6182
6218
  type: "tableCell" | "tableHeader";
6183
6219
  content: {
6184
6220
  __TYPE__: "StructuredTextContent";
@@ -6337,7 +6373,7 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
6337
6373
  } & {
6338
6374
  columnWidth?: number | undefined;
6339
6375
  })[];
6340
- }[];
6376
+ })[];
6341
6377
  } | {
6342
6378
  __TYPE__: "RepeatableContent";
6343
6379
  type: "Link";
@@ -6765,9 +6801,13 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
6765
6801
  __TYPE__: "SeparatorContent";
6766
6802
  } | {
6767
6803
  __TYPE__: "TableContent";
6768
- content: {
6804
+ content: ({
6805
+ key: string;
6806
+ } & {
6769
6807
  type: "tableRow";
6770
6808
  content: ({
6809
+ key: string;
6810
+ } & {
6771
6811
  type: "tableCell" | "tableHeader";
6772
6812
  content: {
6773
6813
  __TYPE__: "StructuredTextContent";
@@ -6926,7 +6966,7 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
6926
6966
  } & {
6927
6967
  columnWidth?: number | undefined;
6928
6968
  })[];
6929
- }[];
6969
+ })[];
6930
6970
  } | {
6931
6971
  __TYPE__: "RepeatableContent";
6932
6972
  type: "Link";
@@ -7352,9 +7392,13 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
7352
7392
  __TYPE__: "SeparatorContent";
7353
7393
  } | {
7354
7394
  __TYPE__: "TableContent";
7355
- content: {
7395
+ content: ({
7396
+ key: string;
7397
+ } & {
7356
7398
  type: "tableRow";
7357
7399
  content: ({
7400
+ key: string;
7401
+ } & {
7358
7402
  type: "tableCell" | "tableHeader";
7359
7403
  content: {
7360
7404
  __TYPE__: "StructuredTextContent";
@@ -7513,7 +7557,7 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
7513
7557
  } & {
7514
7558
  columnWidth?: number | undefined;
7515
7559
  })[];
7516
- }[];
7560
+ })[];
7517
7561
  } | {
7518
7562
  __TYPE__: "RepeatableContent";
7519
7563
  type: "Link";
@@ -14,6 +14,12 @@ declare module "@tiptap/core" {
14
14
  * @example editor.commands.addColumnToEnd()
15
15
  */
16
16
  addColumnToEnd: () => ReturnType;
17
+ /**
18
+ * Move the selected row up or down
19
+ * @returns True if the command was successful, otherwise false
20
+ * @example editor.commands.moveRow("up")
21
+ */
22
+ moveRow: (direction: "up" | "down") => ReturnType;
17
23
  };
18
24
  }
19
25
  }
@@ -1,13 +1,16 @@
1
1
  import { z } from "zod";
2
2
  export declare const tableCellAttrs: z.ZodObject<{
3
+ key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3
4
  colspan: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
4
5
  rowspan: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
5
6
  colwidth: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
6
7
  }, "strip", z.ZodTypeAny, {
8
+ key?: string | null | undefined;
7
9
  colspan?: number | null | undefined;
8
10
  rowspan?: number | null | undefined;
9
11
  colwidth?: number[] | null | undefined;
10
12
  }, {
13
+ key?: string | null | undefined;
11
14
  colspan?: number | null | undefined;
12
15
  rowspan?: number | null | undefined;
13
16
  colwidth?: number[] | null | undefined;
@@ -5,7 +5,6 @@ interface CreateButtonElementArgs {
5
5
  title: string;
6
6
  className: string;
7
7
  tabIndex?: number;
8
- disabled?: boolean;
9
8
  onMouseDown?: (event: MouseEvent, currentTarget: HTMLButtonElement) => void;
10
9
  onClick: (event: MouseEvent, currentTarget: HTMLButtonElement) => void;
11
10
  [key: `data-${string}`]: string | number | boolean;
@@ -0,0 +1,31 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ type Type = "row" | "column";
3
+ export type TableHandleEventDetail = {
4
+ type: Type;
5
+ referenceElement: HTMLElement;
6
+ };
7
+ export type TableAddAtLimitEventDetail = {
8
+ type: Type;
9
+ };
10
+ export type TableEventType = {
11
+ name: "handleClick";
12
+ detail: TableHandleEventDetail;
13
+ } | {
14
+ name: "addAtLimit";
15
+ detail: TableAddAtLimitEventDetail;
16
+ };
17
+ type EventName = TableEventType["name"];
18
+ type EventDetail<TName extends EventName> = Extract<TableEventType, {
19
+ name: TName;
20
+ }>["detail"];
21
+ export declare class TableEvent extends CustomEvent<TableEventType["detail"]> {
22
+ constructor({ name, detail }: TableEventType);
23
+ static dispatch<TName extends EventName>(name: TName, args: {
24
+ editor: Editor;
25
+ } & EventDetail<TName>): void;
26
+ static listen<TName extends EventName>(name: TName, args: {
27
+ editor: Editor;
28
+ callback: (detail: EventDetail<TName>) => void;
29
+ }): () => void;
30
+ }
31
+ export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { Editor } from "@tiptap/core";
3
+ interface LimitModalProps {
4
+ editor: Editor;
5
+ }
6
+ export declare function TableLimitToast(props: LimitModalProps): JSX.Element;
7
+ export {};
@@ -3,6 +3,11 @@ import type { Editor } from "@tiptap/core";
3
3
  * Row utilities
4
4
  */
5
5
  export declare const isFirstRow: (editor: Editor) => boolean;
6
+ export declare function isFirstOrLastRow(editor: Editor): {
7
+ isFirstRow: boolean;
8
+ isLastRow: boolean;
9
+ };
10
+ export declare function isSecondRow(editor: Editor): boolean;
6
11
  export declare const isHeaderRowToggled: (editor: Editor) => boolean;
7
12
  export declare const isSingleRow: (editor: Editor) => boolean;
8
13
  /**
@@ -1,6 +1,6 @@
1
1
  import { Editor } from "@tiptap/core";
2
- import type { Schema } from "@tiptap/pm/model";
3
- import type { Selection } from "@tiptap/pm/state";
2
+ import { type Schema } from "@tiptap/pm/model";
3
+ import type { EditorState, Selection, Transaction } from "@tiptap/pm/state";
4
4
  export declare function getNodeFromSchema(schema: Schema, name: string): import("prosemirror-model").NodeType;
5
5
  export declare function findTable(selection: Selection): {
6
6
  pos: number;
@@ -8,7 +8,53 @@ export declare function findTable(selection: Selection): {
8
8
  depth: number;
9
9
  node: import("prosemirror-model").Node;
10
10
  } | undefined;
11
+ export declare function findRow(selection: Selection): {
12
+ pos: number;
13
+ start: number;
14
+ depth: number;
15
+ node: import("prosemirror-model").Node;
16
+ } | undefined;
17
+ export declare function findTableAndRow(selection: Selection): {
18
+ table: null;
19
+ row: null;
20
+ } | {
21
+ table: null;
22
+ row: {
23
+ pos: number;
24
+ start: number;
25
+ depth: number;
26
+ node: import("prosemirror-model").Node;
27
+ };
28
+ } | {
29
+ table: {
30
+ pos: number;
31
+ start: number;
32
+ depth: number;
33
+ node: import("prosemirror-model").Node;
34
+ };
35
+ row: {
36
+ pos: number;
37
+ start: number;
38
+ depth: number;
39
+ node: import("prosemirror-model").Node;
40
+ };
41
+ };
11
42
  export declare function getTableColumnCount(editor: Editor): number;
12
43
  export declare function getTableRowCount(editor: Editor): number;
13
44
  export declare function isTableColumnLimitReached(editor: Editor): boolean;
14
45
  export declare function isTableRowLimitReached(editor: Editor): boolean;
46
+ export declare function select(type: "row" | "column", args: {
47
+ index: number;
48
+ tr: Transaction;
49
+ }): Transaction;
50
+ export declare function selectRow(args: {
51
+ index: number;
52
+ tr: Transaction;
53
+ }): Transaction;
54
+ export declare function moveRow(args: {
55
+ direction: "up" | "down";
56
+ state: EditorState;
57
+ }): {
58
+ tr: Transaction;
59
+ index: number;
60
+ } | undefined;