@prismicio/editor-fields 0.4.60 → 0.4.62-alpha.jp-table-render-default-layout.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/core/MediaLibrary/MediaLibrary.d.ts +4 -3
- package/dist/core/MediaLibrary/components/MediaLibraryActions.d.ts +2 -2
- package/dist/core/MediaLibrary/components/MediaLibraryContext.d.ts +7 -5
- package/dist/core/MediaLibrary/components/MediaLibraryDropzone.d.ts +3 -2
- package/dist/core/MediaLibrary/components/MediaLibrarySkeleton.d.ts +2 -2
- package/dist/core/MediaLibrary/hooks/useMediaLibraryUpload.d.ts +33 -0
- package/dist/core/MediaLibrary/index.d.ts +0 -1
- package/dist/core/service/customType.d.ts +1972 -8
- package/dist/core/service/document.d.ts +1590 -3
- package/dist/core/service/documentSearch.d.ts +15 -0
- package/dist/fields/ImageField/Components/ImageFieldCard.d.ts +1 -1
- package/dist/fields/ImageField/Components/ImageFieldDropZone.d.ts +9 -0
- package/dist/fields/ImageField/useImageField.d.ts +30 -0
- package/dist/fields/ImageField/useImageFieldImageUpload.d.ts +37 -0
- package/dist/fields/LinkField/Documents/documentsData.d.ts +6 -0
- package/dist/fields/RichTextField/RichTextField.d.ts +6 -5
- package/dist/fields/RichTextField/extensions/Bold/BoldModel.d.ts +2 -2
- package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +30 -0
- package/dist/fields/RichTextField/extensions/Italic/ItalicModel.d.ts +2 -2
- package/dist/fields/RichTextField/extensions/Label/LabelModel.d.ts +2 -2
- package/dist/fields/RichTextField/extensions/Link/LinkModel.d.ts +2 -2
- package/dist/fields/RichTextField/extensions/Table/Table.d.ts +2 -0
- package/dist/fields/RichTextField/extensions/extensions.d.ts +4 -3
- package/dist/fields/RichTextField/models/EditorExtension.d.ts +34 -20
- package/dist/fields/RichTextField/models/RichTextConfig.d.ts +3 -2
- package/dist/fields/RichTextField/types.d.ts +37 -0
- package/dist/fields/TableField/TableField.d.ts +12 -0
- package/dist/fields/TableField/index.d.ts +1 -0
- package/dist/fields/utils.d.ts +2 -2
- package/dist/index.cjs.js +56 -53
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +30129 -25537
- package/dist/slices/utils.d.ts +138 -0
- package/package.json +9 -5
- package/dist/constants/localStorage.d.ts +0 -1
- package/dist/core/MediaLibrary/components/NewMediaLibraryFeaturesBanner.d.ts +0 -6
- package/dist/fields/RichTextField/extensions/Image/ImageLinkControl.d.ts +0 -0
|
@@ -85,6 +85,9 @@ export declare function searchDocuments(args: SearchDocumentsArgs): Promise<{
|
|
|
85
85
|
custom_type_id?: string | undefined;
|
|
86
86
|
summary?: string | undefined;
|
|
87
87
|
author_ids?: string[] | undefined;
|
|
88
|
+
highlights?: {
|
|
89
|
+
uid?: string | undefined;
|
|
90
|
+
} | undefined;
|
|
88
91
|
})[];
|
|
89
92
|
}[];
|
|
90
93
|
}>;
|
|
@@ -168,6 +171,9 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
168
171
|
custom_type_id?: string | undefined;
|
|
169
172
|
summary?: string | undefined;
|
|
170
173
|
author_ids?: string[] | undefined;
|
|
174
|
+
highlights?: {
|
|
175
|
+
uid?: string | undefined;
|
|
176
|
+
} | undefined;
|
|
171
177
|
})[];
|
|
172
178
|
}[];
|
|
173
179
|
}, Error, {
|
|
@@ -231,6 +237,9 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
231
237
|
custom_type_id?: string | undefined;
|
|
232
238
|
summary?: string | undefined;
|
|
233
239
|
author_ids?: string[] | undefined;
|
|
240
|
+
highlights?: {
|
|
241
|
+
uid?: string | undefined;
|
|
242
|
+
} | undefined;
|
|
234
243
|
})[];
|
|
235
244
|
}[];
|
|
236
245
|
}, readonly ["searchDocuments", {
|
|
@@ -316,6 +325,9 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
316
325
|
custom_type_id?: string | undefined;
|
|
317
326
|
summary?: string | undefined;
|
|
318
327
|
author_ids?: string[] | undefined;
|
|
328
|
+
highlights?: {
|
|
329
|
+
uid?: string | undefined;
|
|
330
|
+
} | undefined;
|
|
319
331
|
})[];
|
|
320
332
|
}[];
|
|
321
333
|
}> | undefined;
|
|
@@ -402,6 +414,9 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
402
414
|
custom_type_id?: string | undefined;
|
|
403
415
|
summary?: string | undefined;
|
|
404
416
|
author_ids?: string[] | undefined;
|
|
417
|
+
highlights?: {
|
|
418
|
+
uid?: string | undefined;
|
|
419
|
+
} | undefined;
|
|
405
420
|
})[];
|
|
406
421
|
}[];
|
|
407
422
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type MediaAssetOrExternalImage } from "../../../core/MediaLibrary/hooks/mediaLibraryData";
|
|
3
3
|
interface ImageFieldCardProps {
|
|
4
4
|
isMediaDialogOpen: boolean;
|
|
5
5
|
selected?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface ImageFieldDropZoneProps {
|
|
3
|
+
uploadImage: (file: File) => void;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isUploading: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ImageFieldDropZone(props: ImageFieldDropZoneProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -87,5 +87,35 @@ export declare function useImageField(props: useImageFieldProps): {
|
|
|
87
87
|
provider?: string | null | undefined;
|
|
88
88
|
}) | undefined;
|
|
89
89
|
onClear: () => void;
|
|
90
|
+
uploadImage: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<{
|
|
91
|
+
tags: {
|
|
92
|
+
name: string;
|
|
93
|
+
id: string;
|
|
94
|
+
created_at: number;
|
|
95
|
+
last_modified: number;
|
|
96
|
+
count: number;
|
|
97
|
+
uploader_id?: string | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
id: string;
|
|
100
|
+
url: string;
|
|
101
|
+
kind: string;
|
|
102
|
+
size: number;
|
|
103
|
+
last_modified: number;
|
|
104
|
+
filename: string;
|
|
105
|
+
width?: number | undefined;
|
|
106
|
+
height?: number | undefined;
|
|
107
|
+
credits?: string | undefined;
|
|
108
|
+
alt?: string | undefined;
|
|
109
|
+
notes?: string | undefined;
|
|
110
|
+
uploader_id?: string | undefined;
|
|
111
|
+
extension?: string | undefined;
|
|
112
|
+
search_highlight?: {
|
|
113
|
+
credits?: string | undefined;
|
|
114
|
+
alt?: string | undefined;
|
|
115
|
+
notes?: string | undefined;
|
|
116
|
+
filename?: string | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
}, Error, File, unknown>;
|
|
119
|
+
isUploadingImage: boolean;
|
|
90
120
|
};
|
|
91
121
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MediaAssetOrExternalImage } from "../../core/MediaLibrary/hooks/mediaLibraryData";
|
|
2
|
+
interface UseImageFieldImageUploadArgs {
|
|
3
|
+
onMediaSelected: (media: MediaAssetOrExternalImage) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function useImageFieldImageUpload(args: UseImageFieldImageUploadArgs): {
|
|
6
|
+
uploadImage: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<{
|
|
7
|
+
tags: {
|
|
8
|
+
name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
created_at: number;
|
|
11
|
+
last_modified: number;
|
|
12
|
+
count: number;
|
|
13
|
+
uploader_id?: string | undefined;
|
|
14
|
+
}[];
|
|
15
|
+
id: string;
|
|
16
|
+
url: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
size: number;
|
|
19
|
+
last_modified: number;
|
|
20
|
+
filename: string;
|
|
21
|
+
width?: number | undefined;
|
|
22
|
+
height?: number | undefined;
|
|
23
|
+
credits?: string | undefined;
|
|
24
|
+
alt?: string | undefined;
|
|
25
|
+
notes?: string | undefined;
|
|
26
|
+
uploader_id?: string | undefined;
|
|
27
|
+
extension?: string | undefined;
|
|
28
|
+
search_highlight?: {
|
|
29
|
+
credits?: string | undefined;
|
|
30
|
+
alt?: string | undefined;
|
|
31
|
+
notes?: string | undefined;
|
|
32
|
+
filename?: string | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}, Error, File, unknown>;
|
|
35
|
+
isUploadingImage: boolean;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -47,6 +47,9 @@ export declare function useDocuments(params: {
|
|
|
47
47
|
custom_type_id?: string | undefined;
|
|
48
48
|
summary?: string | undefined;
|
|
49
49
|
author_ids?: string[] | undefined;
|
|
50
|
+
highlights?: {
|
|
51
|
+
uid?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
50
53
|
}))[];
|
|
51
54
|
id: string;
|
|
52
55
|
title: string;
|
|
@@ -99,6 +102,9 @@ export declare function useDocuments(params: {
|
|
|
99
102
|
custom_type_id?: string | undefined;
|
|
100
103
|
summary?: string | undefined;
|
|
101
104
|
author_ids?: string[] | undefined;
|
|
105
|
+
highlights?: {
|
|
106
|
+
uid?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
102
108
|
}))[];
|
|
103
109
|
id: string;
|
|
104
110
|
title: string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { RichTextContent } from "@prismicio/types-internal/lib/content";
|
|
3
2
|
import type { RichText } from "@prismicio/types-internal/lib/customtypes";
|
|
4
|
-
|
|
3
|
+
import type { ExtendedRichTextContent } from "./types";
|
|
4
|
+
interface Props<T> {
|
|
5
5
|
id: string;
|
|
6
|
-
content:
|
|
6
|
+
content: T | undefined;
|
|
7
7
|
field: RichText;
|
|
8
8
|
readOnly: boolean;
|
|
9
|
-
onContentChange: (content:
|
|
9
|
+
onContentChange: (content: T | undefined) => void;
|
|
10
|
+
converter?: (value: T) => ExtendedRichTextContent;
|
|
10
11
|
}
|
|
11
|
-
export declare function RichTextField(props: Props): JSX.Element;
|
|
12
|
+
export declare function RichTextField<T extends ExtendedRichTextContent>(props: Props<T>): JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
1
|
import type { Mark } from "@tiptap/core";
|
|
3
2
|
import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
|
|
4
3
|
import { ExtensionType } from "../../models";
|
|
4
|
+
import type { ExtendedRichTextNodeType } from "../../types";
|
|
5
5
|
export declare class BoldExtension {
|
|
6
6
|
readonly name: "bold";
|
|
7
7
|
readonly component: Mark;
|
|
@@ -10,7 +10,7 @@ export declare class BoldExtension {
|
|
|
10
10
|
toPrismic(elmt: ProsemirrorMark): undefined;
|
|
11
11
|
};
|
|
12
12
|
extType: ExtensionType.Mark;
|
|
13
|
-
richTextNodeTypes:
|
|
13
|
+
richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
14
14
|
constructor(name: "bold", component: Mark, converter: {
|
|
15
15
|
fromPrismic(schema: Schema): (elmt: BoldElement) => ProsemirrorMark | undefined;
|
|
16
16
|
toPrismic(elmt: ProsemirrorMark): undefined;
|
|
@@ -19,5 +19,35 @@ export declare function useImageView(props: useImageViewProps): {
|
|
|
19
19
|
isUpdating: boolean;
|
|
20
20
|
updateContent: (content?: ImageBlockData) => void;
|
|
21
21
|
onClear: () => void;
|
|
22
|
+
uploadImage: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<{
|
|
23
|
+
tags: {
|
|
24
|
+
name: string;
|
|
25
|
+
id: string;
|
|
26
|
+
created_at: number;
|
|
27
|
+
last_modified: number;
|
|
28
|
+
count: number;
|
|
29
|
+
uploader_id?: string | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
id: string;
|
|
32
|
+
url: string;
|
|
33
|
+
kind: string;
|
|
34
|
+
size: number;
|
|
35
|
+
last_modified: number;
|
|
36
|
+
filename: string;
|
|
37
|
+
width?: number | undefined;
|
|
38
|
+
height?: number | undefined;
|
|
39
|
+
credits?: string | undefined;
|
|
40
|
+
alt?: string | undefined;
|
|
41
|
+
notes?: string | undefined;
|
|
42
|
+
uploader_id?: string | undefined;
|
|
43
|
+
extension?: string | undefined;
|
|
44
|
+
search_highlight?: {
|
|
45
|
+
credits?: string | undefined;
|
|
46
|
+
alt?: string | undefined;
|
|
47
|
+
notes?: string | undefined;
|
|
48
|
+
filename?: string | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}, Error, File, unknown>;
|
|
51
|
+
isUploadingImage: boolean;
|
|
22
52
|
};
|
|
23
53
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
1
|
import type { Mark } from "@tiptap/core";
|
|
3
2
|
import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
|
|
4
3
|
import { ExtensionType } from "../../models";
|
|
4
|
+
import type { ExtendedRichTextNodeType } from "../../types";
|
|
5
5
|
export declare class ItalicExtension {
|
|
6
6
|
readonly name: "em";
|
|
7
7
|
readonly component: Mark;
|
|
@@ -10,7 +10,7 @@ export declare class ItalicExtension {
|
|
|
10
10
|
toPrismic(elmt: ProsemirrorMark): undefined;
|
|
11
11
|
};
|
|
12
12
|
extType: ExtensionType.Mark;
|
|
13
|
-
richTextNodeTypes:
|
|
13
|
+
richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
14
14
|
constructor(name: "em", component: Mark, converter: {
|
|
15
15
|
fromPrismic(schema: Schema): (elmt: ItalicElement) => ProsemirrorMark | undefined;
|
|
16
16
|
toPrismic(elmt: ProsemirrorMark): undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
1
|
import type { Mark } from "@tiptap/core";
|
|
3
2
|
import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
|
|
4
3
|
import { ExtensionType } from "../../models";
|
|
4
|
+
import type { ExtendedRichTextNodeType } from "../../types";
|
|
5
5
|
export declare class LabelExtension {
|
|
6
6
|
readonly name: "label";
|
|
7
7
|
readonly component: Mark;
|
|
@@ -10,7 +10,7 @@ export declare class LabelExtension {
|
|
|
10
10
|
toPrismic(elmt: ProsemirrorMark): LabelElementData;
|
|
11
11
|
};
|
|
12
12
|
extType: ExtensionType.Mark;
|
|
13
|
-
richTextNodeTypes:
|
|
13
|
+
richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
14
14
|
constructor(name: "label", component: Mark, converter: {
|
|
15
15
|
fromPrismic(schema: Schema): (elmt: LabelElement) => ProsemirrorMark | undefined;
|
|
16
16
|
toPrismic(elmt: ProsemirrorMark): LabelElementData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
1
|
import type { Mark } from "@tiptap/core";
|
|
3
2
|
import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
|
|
4
3
|
import { ExtensionType } from "../../models";
|
|
4
|
+
import type { ExtendedRichTextNodeType } from "../../types";
|
|
5
5
|
export declare class LinkExtension {
|
|
6
6
|
readonly name: "hyperlink";
|
|
7
7
|
readonly component: Mark;
|
|
@@ -10,7 +10,7 @@ export declare class LinkExtension {
|
|
|
10
10
|
toPrismic(elmt: ProsemirrorMark): LinkElementData;
|
|
11
11
|
};
|
|
12
12
|
extType: ExtensionType.Mark;
|
|
13
|
-
richTextNodeTypes:
|
|
13
|
+
richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
14
14
|
constructor(name: "hyperlink", component: Mark, converter: {
|
|
15
15
|
fromPrismic(schema: Schema): (elmt: LinkElement) => ProsemirrorMark | undefined;
|
|
16
16
|
toPrismic(elmt: ProsemirrorMark): LinkElementData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
1
|
import type { WidgetExtension } from "../models";
|
|
2
|
+
import { ExtendedRichTextNodeType } from "../types";
|
|
3
3
|
import { default as Bold } from "./Bold/Bold";
|
|
4
4
|
import { default as BulletList } from "./BulletList/BulletList";
|
|
5
5
|
import { default as CodeBlock } from "./CodeBlock/CodeBlock";
|
|
@@ -11,7 +11,8 @@ import { Label } from "./Label/Label";
|
|
|
11
11
|
import { Link } from "./Link/Link";
|
|
12
12
|
import { default as OrderedList } from "./OrderedList/OrderedList";
|
|
13
13
|
import { default as Paragraph } from "./Paragraph/Paragraph";
|
|
14
|
+
import { Table } from "./Table/Table";
|
|
14
15
|
export declare const MarkExtensions: (import("./Bold/BoldModel").BoldExtension | import("./Italic/ItalicModel").ItalicExtension | import("./Link/LinkModel").LinkExtension | import("./Label/LabelModel").LabelExtension)[];
|
|
15
16
|
export type MarkExtensionName = (typeof MarkExtensions)[number]["name"];
|
|
16
|
-
export declare function getAllExtensions(nodeTypes?: Set<
|
|
17
|
-
export { Bold, BulletList, CodeBlock, Embed, Heading, Image, Italic, Label, Link, OrderedList, Paragraph, };
|
|
17
|
+
export declare function getAllExtensions(nodeTypes?: Set<ExtendedRichTextNodeType>): WidgetExtension[];
|
|
18
|
+
export { Bold, BulletList, CodeBlock, Embed, Heading, Image, Italic, Label, Link, OrderedList, Paragraph, Table, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { EmbedBlock, ImageBlock,
|
|
2
|
-
import type { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
|
|
1
|
+
import type { EmbedBlock, ImageBlock, TextBlock } from "@prismicio/types-internal/lib/content";
|
|
3
2
|
import type { Node } from "@tiptap/core";
|
|
4
3
|
import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
|
|
5
4
|
import type { BoldExtension } from "../extensions/Bold/BoldModel";
|
|
@@ -7,6 +6,7 @@ import type { Level } from "../extensions/Heading/Heading";
|
|
|
7
6
|
import type { ItalicExtension } from "../extensions/Italic/ItalicModel";
|
|
8
7
|
import type { LabelExtension } from "../extensions/Label/LabelModel";
|
|
9
8
|
import type { LinkExtension } from "../extensions/Link/LinkModel";
|
|
9
|
+
import type { ExtendedRichTextContent, ExtendedRichTextNodeType, TableBlock } from "../types";
|
|
10
10
|
export declare enum ExtensionType {
|
|
11
11
|
Document = "document",
|
|
12
12
|
Mark = "mark",
|
|
@@ -15,28 +15,27 @@ export declare enum ExtensionType {
|
|
|
15
15
|
export declare enum NodeType {
|
|
16
16
|
Text = "text",
|
|
17
17
|
Embed = "embed",
|
|
18
|
-
Image = "image"
|
|
18
|
+
Image = "image",
|
|
19
|
+
Table = "table"
|
|
19
20
|
}
|
|
20
21
|
export type Extension = WidgetExtension | DocumentExtension;
|
|
21
22
|
export type WidgetExtension = MarkExtension | NodeExtension;
|
|
22
23
|
export type ExtensionPlaceholder = string | ((nodeAttrs: ProsemirrorNode["attrs"]) => string | undefined) | undefined;
|
|
24
|
+
export type DocumentConverterReturnType<T extends ExtendedRichTextContent> = {
|
|
25
|
+
fromPrismic(schema: Schema, nodeTypes: Set<ExtendedRichTextNodeType>, content: T): ProsemirrorNode | undefined;
|
|
26
|
+
toPrismic(node: ProsemirrorNode): T | undefined;
|
|
27
|
+
};
|
|
23
28
|
export declare class DocumentExtension {
|
|
24
29
|
readonly name: string;
|
|
25
30
|
readonly component: (multiLines: boolean) => Node;
|
|
26
|
-
readonly converter: (extensions: NodeExtension[]) =>
|
|
27
|
-
fromPrismic(schema: Schema, nodeTypes: Set<RichTextNodeType>, content: RichTextContent): ProsemirrorNode | undefined;
|
|
28
|
-
toPrismic(node: ProsemirrorNode): RichTextContent | undefined;
|
|
29
|
-
};
|
|
31
|
+
readonly converter: <T extends ExtendedRichTextContent = ExtendedRichTextContent>(extensions: NodeExtension[]) => DocumentConverterReturnType<T>;
|
|
30
32
|
extType: ExtensionType.Document;
|
|
31
|
-
constructor(name: string, component: (multiLines: boolean) => Node, converter: (extensions: NodeExtension[]) =>
|
|
32
|
-
fromPrismic(schema: Schema, nodeTypes: Set<RichTextNodeType>, content: RichTextContent): ProsemirrorNode | undefined;
|
|
33
|
-
toPrismic(node: ProsemirrorNode): RichTextContent | undefined;
|
|
34
|
-
});
|
|
33
|
+
constructor(name: string, component: (multiLines: boolean) => Node, converter: <T extends ExtendedRichTextContent = ExtendedRichTextContent>(extensions: NodeExtension[]) => DocumentConverterReturnType<T>);
|
|
35
34
|
}
|
|
36
35
|
export type MarkExtension = LinkExtension | BoldExtension | ItalicExtension | LabelExtension;
|
|
37
|
-
export type NodeExtension = TextExtension | EmbedExtension | ImageExtension;
|
|
36
|
+
export type NodeExtension = TextExtension | EmbedExtension | ImageExtension | TableExtension;
|
|
38
37
|
export declare class TextExtension {
|
|
39
|
-
readonly richTextNodeTypes:
|
|
38
|
+
readonly richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
40
39
|
readonly name: string;
|
|
41
40
|
readonly component: Node;
|
|
42
41
|
readonly converter: {
|
|
@@ -47,14 +46,14 @@ export declare class TextExtension {
|
|
|
47
46
|
readonly lockedFormat: boolean;
|
|
48
47
|
extType: ExtensionType.Node;
|
|
49
48
|
nodeType: NodeType.Text;
|
|
50
|
-
constructor(richTextNodeTypes:
|
|
49
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], name: string, component: Node, converter: {
|
|
51
50
|
fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
|
|
52
51
|
toPrismic(elmt: ProsemirrorNode): TextBlock | readonly TextBlock[] | undefined;
|
|
53
52
|
}, placeholder?: ExtensionPlaceholder, lockedFormat?: boolean);
|
|
54
53
|
}
|
|
55
54
|
export declare function isTextExtension(extension: WidgetExtension): extension is TextExtension;
|
|
56
55
|
export declare class EmbedExtension {
|
|
57
|
-
readonly richTextNodeTypes:
|
|
56
|
+
readonly richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
58
57
|
readonly name: string;
|
|
59
58
|
readonly component: Node;
|
|
60
59
|
readonly converter: {
|
|
@@ -63,13 +62,13 @@ export declare class EmbedExtension {
|
|
|
63
62
|
};
|
|
64
63
|
extType: ExtensionType;
|
|
65
64
|
nodeType: NodeType.Embed;
|
|
66
|
-
constructor(richTextNodeTypes:
|
|
65
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], name: string, component: Node, converter: {
|
|
67
66
|
fromPrismic(schema: Schema): (elmt: EmbedBlock) => ProsemirrorNode | undefined;
|
|
68
67
|
toPrismic(elmt: ProsemirrorNode): EmbedBlock | undefined;
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
export declare class ImageExtension {
|
|
72
|
-
readonly richTextNodeTypes:
|
|
71
|
+
readonly richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
73
72
|
readonly name: string;
|
|
74
73
|
readonly component: Node;
|
|
75
74
|
readonly converter: {
|
|
@@ -78,22 +77,37 @@ export declare class ImageExtension {
|
|
|
78
77
|
};
|
|
79
78
|
extType: ExtensionType.Node;
|
|
80
79
|
nodeType: NodeType.Image;
|
|
81
|
-
constructor(richTextNodeTypes:
|
|
80
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], name: string, component: Node, converter: {
|
|
82
81
|
fromPrismic(schema: Schema): (elmt: ImageBlock) => ProsemirrorNode | undefined;
|
|
83
82
|
toPrismic(elmt: ProsemirrorNode): ImageBlock | undefined;
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
export declare class HeadingTextExtension extends TextExtension {
|
|
87
86
|
readonly levels: readonly Level[];
|
|
88
|
-
constructor(richTextNodeTypes:
|
|
87
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], Component: Node, levels: readonly Level[], Converter: {
|
|
89
88
|
fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
|
|
90
89
|
toPrismic(elmt: ProsemirrorNode): TextBlock | undefined;
|
|
91
90
|
}, placeholder?: ExtensionPlaceholder);
|
|
92
91
|
}
|
|
93
92
|
export declare class ListExtension extends TextExtension {
|
|
94
|
-
constructor(richTextNodeTypes:
|
|
93
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], name: string, Component: Node, Converter: {
|
|
95
94
|
fromPrismic(schema: Schema): (elmt: TextBlock) => ProsemirrorNode | undefined;
|
|
96
95
|
toPrismic(elmt: ProsemirrorNode): readonly TextBlock[];
|
|
97
96
|
});
|
|
98
97
|
}
|
|
98
|
+
export declare class TableExtension {
|
|
99
|
+
readonly richTextNodeTypes: ExtendedRichTextNodeType[];
|
|
100
|
+
readonly name: string;
|
|
101
|
+
readonly component: Node[];
|
|
102
|
+
readonly converter: {
|
|
103
|
+
fromPrismic(schema: Schema): (elmt: TableBlock) => ProsemirrorNode | undefined;
|
|
104
|
+
toPrismic(elmt: ProsemirrorNode): TableBlock | undefined;
|
|
105
|
+
};
|
|
106
|
+
extType: ExtensionType.Node;
|
|
107
|
+
nodeType: NodeType.Table;
|
|
108
|
+
constructor(richTextNodeTypes: ExtendedRichTextNodeType[], name: string, component: Node[], converter: {
|
|
109
|
+
fromPrismic(schema: Schema): (elmt: TableBlock) => ProsemirrorNode | undefined;
|
|
110
|
+
toPrismic(elmt: ProsemirrorNode): TableBlock | undefined;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
99
113
|
export declare function isListExtension(extension: WidgetExtension): extension is ListExtension;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { RichTextConfig
|
|
1
|
+
import { RichTextConfig } from "@prismicio/types-internal/lib/customtypes";
|
|
2
|
+
import type { ExtendedRichTextNodeType } from "../types";
|
|
2
3
|
import { type WidgetExtension } from "./EditorExtension";
|
|
3
4
|
export declare function composeExtensions(config?: RichTextConfig): Extensions;
|
|
4
5
|
interface Extensions {
|
|
5
6
|
extensions: WidgetExtension[];
|
|
6
|
-
nodeTypes: Set<
|
|
7
|
+
nodeTypes: Set<ExtendedRichTextNodeType>;
|
|
7
8
|
}
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Here live the types to extend RichTextField.
|
|
2
|
+
*
|
|
3
|
+
* Table: The table extension is only used internally by TableField, but it's
|
|
4
|
+
* not supported by the RichText field itself. This means that a user cannot
|
|
5
|
+
* create a table in a regular RichTextField.
|
|
6
|
+
*/
|
|
7
|
+
import type { EmbedBlock, ImageBlock, RichTextContent, TableContent, TextBlock } from "@prismicio/types-internal/lib/content";
|
|
8
|
+
export type ExtendedBlock = EmbedBlock | ImageBlock | TextBlock | TableBlock;
|
|
9
|
+
export interface ExtendedRichTextContent extends Omit<RichTextContent, "value"> {
|
|
10
|
+
value: ExtendedBlock[];
|
|
11
|
+
}
|
|
12
|
+
export interface TableBlock {
|
|
13
|
+
type: "table";
|
|
14
|
+
content: TableContent["content"];
|
|
15
|
+
}
|
|
16
|
+
export declare const isTableBlock: (block: ExtendedBlock) => block is TableBlock;
|
|
17
|
+
export declare const ExtendedRichTextNodeType: {
|
|
18
|
+
readonly table: "table";
|
|
19
|
+
readonly heading1: "heading1";
|
|
20
|
+
readonly heading2: "heading2";
|
|
21
|
+
readonly heading3: "heading3";
|
|
22
|
+
readonly heading4: "heading4";
|
|
23
|
+
readonly heading5: "heading5";
|
|
24
|
+
readonly heading6: "heading6";
|
|
25
|
+
readonly paragraph: "paragraph";
|
|
26
|
+
readonly strong: "strong";
|
|
27
|
+
readonly em: "em";
|
|
28
|
+
readonly preformatted: "preformatted";
|
|
29
|
+
readonly hyperlink: "hyperlink";
|
|
30
|
+
readonly image: "image";
|
|
31
|
+
readonly embed: "embed";
|
|
32
|
+
readonly list: "list-item";
|
|
33
|
+
readonly orderedList: "o-list-item";
|
|
34
|
+
readonly rtl: "rtl";
|
|
35
|
+
};
|
|
36
|
+
export type ExtendedRichTextNodeType = (typeof ExtendedRichTextNodeType)[keyof typeof ExtendedRichTextNodeType];
|
|
37
|
+
export declare function isExtendedRichTextNodeTypeSet(set: Set<unknown> | undefined): set is Set<ExtendedRichTextNodeType>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableContent } from "@prismicio/types-internal/lib/content";
|
|
3
|
+
import { type Table } from "@prismicio/types-internal/lib/customtypes";
|
|
4
|
+
interface Props {
|
|
5
|
+
id: string;
|
|
6
|
+
field: Table;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
content: TableContent | undefined;
|
|
9
|
+
onContentChange: (content: TableContent | undefined) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function TableField(props: Props): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableField } from "./TableField";
|
package/dist/fields/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BooleanField, GeoPoint, NestableWidget, Separator, UID } from "@prismicio/types-internal/lib/customtypes";
|
|
1
|
+
import type { BooleanField, GeoPoint, NestableWidget, Separator, Table, UID } from "@prismicio/types-internal/lib/customtypes";
|
|
2
2
|
type Widgets = NestableWidget | UID;
|
|
3
3
|
type Field = Exclude<Widgets, Separator | GeoPoint>;
|
|
4
4
|
export declare function getFieldLabel(field: Widgets): string;
|
|
5
5
|
export declare const DEFAULT_PLACEHOLDER = "...";
|
|
6
6
|
export declare function getBooleanFieldPlaceholder(field: BooleanField, value: boolean, defaultPlaceholder?: string): string;
|
|
7
|
-
export declare function getFieldPlaceholder(field: Exclude<Field, BooleanField>, defaultPlaceholder?: string): string;
|
|
7
|
+
export declare function getFieldPlaceholder(field: Exclude<Field, BooleanField | Table>, defaultPlaceholder?: string): string;
|
|
8
8
|
export {};
|