@prismicio/editor-fields 0.4.61 → 0.4.62-alpha.jp-table-render-default-layout.2
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/components/MediaLibraryDropzone.d.ts +3 -2
- package/dist/core/MediaLibrary/hooks/mediaLibraryData.d.ts +45 -45
- package/dist/core/MediaLibrary/hooks/useMediaLibraryUpload.d.ts +33 -0
- package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +5 -5
- package/dist/core/MediaLibrary/index.d.ts +0 -1
- package/dist/core/UnsplashLibrary/unsplashData.d.ts +18 -18
- package/dist/core/service/customType.d.ts +84 -18
- package/dist/core/service/document.d.ts +2111 -140
- package/dist/core/service/documentSearch.d.ts +15 -15
- package/dist/core/service/role.d.ts +0 -1
- 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 -6
- package/dist/fields/RichTextField/RichTextField.d.ts +5 -5
- package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +2 -2
- 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/models/helpers/NodeUtils.d.ts +1 -1
- package/dist/fields/RichTextField/types.d.ts +41 -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 +30026 -25413
- package/dist/slices/utils.d.ts +163 -1
- 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
|
@@ -45,8 +45,8 @@ export declare function searchDocuments(args: SearchDocumentsArgs): Promise<{
|
|
|
45
45
|
} | {
|
|
46
46
|
status: "archived";
|
|
47
47
|
}) & {
|
|
48
|
-
tags: string[];
|
|
49
48
|
version_id: string;
|
|
49
|
+
tags: string[];
|
|
50
50
|
last_modified_date: Date;
|
|
51
51
|
custom_type_label: string;
|
|
52
52
|
author: {
|
|
@@ -77,13 +77,13 @@ export declare function searchDocuments(args: SearchDocumentsArgs): Promise<{
|
|
|
77
77
|
} | {
|
|
78
78
|
status: "archived";
|
|
79
79
|
}) & {
|
|
80
|
-
tags: string[];
|
|
81
80
|
version_id: string;
|
|
81
|
+
tags: string[];
|
|
82
82
|
last_modified_date: Date;
|
|
83
|
+
summary?: string | undefined;
|
|
83
84
|
preview_image?: string | undefined;
|
|
84
85
|
uid?: string | undefined;
|
|
85
86
|
custom_type_id?: string | undefined;
|
|
86
|
-
summary?: string | undefined;
|
|
87
87
|
author_ids?: string[] | undefined;
|
|
88
88
|
highlights?: {
|
|
89
89
|
uid?: string | undefined;
|
|
@@ -131,8 +131,8 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
131
131
|
} | {
|
|
132
132
|
status: "archived";
|
|
133
133
|
}) & {
|
|
134
|
-
tags: string[];
|
|
135
134
|
version_id: string;
|
|
135
|
+
tags: string[];
|
|
136
136
|
last_modified_date: Date;
|
|
137
137
|
custom_type_label: string;
|
|
138
138
|
author: {
|
|
@@ -163,13 +163,13 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
163
163
|
} | {
|
|
164
164
|
status: "archived";
|
|
165
165
|
}) & {
|
|
166
|
-
tags: string[];
|
|
167
166
|
version_id: string;
|
|
167
|
+
tags: string[];
|
|
168
168
|
last_modified_date: Date;
|
|
169
|
+
summary?: string | undefined;
|
|
169
170
|
preview_image?: string | undefined;
|
|
170
171
|
uid?: string | undefined;
|
|
171
172
|
custom_type_id?: string | undefined;
|
|
172
|
-
summary?: string | undefined;
|
|
173
173
|
author_ids?: string[] | undefined;
|
|
174
174
|
highlights?: {
|
|
175
175
|
uid?: string | undefined;
|
|
@@ -197,8 +197,8 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
197
197
|
} | {
|
|
198
198
|
status: "archived";
|
|
199
199
|
}) & {
|
|
200
|
-
tags: string[];
|
|
201
200
|
version_id: string;
|
|
201
|
+
tags: string[];
|
|
202
202
|
last_modified_date: Date;
|
|
203
203
|
custom_type_label: string;
|
|
204
204
|
author: {
|
|
@@ -229,13 +229,13 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
229
229
|
} | {
|
|
230
230
|
status: "archived";
|
|
231
231
|
}) & {
|
|
232
|
-
tags: string[];
|
|
233
232
|
version_id: string;
|
|
233
|
+
tags: string[];
|
|
234
234
|
last_modified_date: Date;
|
|
235
|
+
summary?: string | undefined;
|
|
235
236
|
preview_image?: string | undefined;
|
|
236
237
|
uid?: string | undefined;
|
|
237
238
|
custom_type_id?: string | undefined;
|
|
238
|
-
summary?: string | undefined;
|
|
239
239
|
author_ids?: string[] | undefined;
|
|
240
240
|
highlights?: {
|
|
241
241
|
uid?: string | undefined;
|
|
@@ -285,8 +285,8 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
285
285
|
} | {
|
|
286
286
|
status: "archived";
|
|
287
287
|
}) & {
|
|
288
|
-
tags: string[];
|
|
289
288
|
version_id: string;
|
|
289
|
+
tags: string[];
|
|
290
290
|
last_modified_date: Date;
|
|
291
291
|
custom_type_label: string;
|
|
292
292
|
author: {
|
|
@@ -317,13 +317,13 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
317
317
|
} | {
|
|
318
318
|
status: "archived";
|
|
319
319
|
}) & {
|
|
320
|
-
tags: string[];
|
|
321
320
|
version_id: string;
|
|
321
|
+
tags: string[];
|
|
322
322
|
last_modified_date: Date;
|
|
323
|
+
summary?: string | undefined;
|
|
323
324
|
preview_image?: string | undefined;
|
|
324
325
|
uid?: string | undefined;
|
|
325
326
|
custom_type_id?: string | undefined;
|
|
326
|
-
summary?: string | undefined;
|
|
327
327
|
author_ids?: string[] | undefined;
|
|
328
328
|
highlights?: {
|
|
329
329
|
uid?: string | undefined;
|
|
@@ -374,8 +374,8 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
374
374
|
} | {
|
|
375
375
|
status: "archived";
|
|
376
376
|
}) & {
|
|
377
|
-
tags: string[];
|
|
378
377
|
version_id: string;
|
|
378
|
+
tags: string[];
|
|
379
379
|
last_modified_date: Date;
|
|
380
380
|
custom_type_label: string;
|
|
381
381
|
author: {
|
|
@@ -406,13 +406,13 @@ export declare function searchDocumentsQueryOptions(args: SearchDocumentsQueryOp
|
|
|
406
406
|
} | {
|
|
407
407
|
status: "archived";
|
|
408
408
|
}) & {
|
|
409
|
-
tags: string[];
|
|
410
409
|
version_id: string;
|
|
410
|
+
tags: string[];
|
|
411
411
|
last_modified_date: Date;
|
|
412
|
+
summary?: string | undefined;
|
|
412
413
|
preview_image?: string | undefined;
|
|
413
414
|
uid?: string | undefined;
|
|
414
415
|
custom_type_id?: string | undefined;
|
|
415
|
-
summary?: string | undefined;
|
|
416
416
|
author_ids?: string[] | undefined;
|
|
417
417
|
highlights?: {
|
|
418
418
|
uid?: string | undefined;
|
|
@@ -85,7 +85,6 @@ interface GetTeamSpacesArgs {
|
|
|
85
85
|
baseUrl: URL;
|
|
86
86
|
repository: string;
|
|
87
87
|
authStrategy: AuthStrategy;
|
|
88
|
-
fetchEnabled: boolean;
|
|
89
88
|
}
|
|
90
89
|
export declare function getTeamSpaces(args: GetTeamSpacesArgs): Promise<TeamSpacesResponse>;
|
|
91
90
|
export declare function getTeamSpacesOptions(args: GetTeamSpacesArgs): import("@tanstack/react-query/build/legacy/types").UseQueryOptions<{
|
|
@@ -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
|
+
kind: string;
|
|
92
|
+
id: string;
|
|
93
|
+
url: string;
|
|
94
|
+
size: number;
|
|
95
|
+
tags: {
|
|
96
|
+
name: string;
|
|
97
|
+
id: string;
|
|
98
|
+
created_at: number;
|
|
99
|
+
last_modified: number;
|
|
100
|
+
count: number;
|
|
101
|
+
uploader_id?: string | undefined;
|
|
102
|
+
}[];
|
|
103
|
+
last_modified: number;
|
|
104
|
+
filename: string;
|
|
105
|
+
height?: number | undefined;
|
|
106
|
+
width?: 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
|
+
kind: string;
|
|
8
|
+
id: string;
|
|
9
|
+
url: string;
|
|
10
|
+
size: number;
|
|
11
|
+
tags: {
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
created_at: number;
|
|
15
|
+
last_modified: number;
|
|
16
|
+
count: number;
|
|
17
|
+
uploader_id?: string | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
last_modified: number;
|
|
20
|
+
filename: string;
|
|
21
|
+
height?: number | undefined;
|
|
22
|
+
width?: 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 {};
|
|
@@ -16,8 +16,8 @@ export declare function useDocuments(params: {
|
|
|
16
16
|
} | {
|
|
17
17
|
status: "archived";
|
|
18
18
|
}) & {
|
|
19
|
-
tags: string[];
|
|
20
19
|
version_id: string;
|
|
20
|
+
tags: string[];
|
|
21
21
|
last_modified_date: Date;
|
|
22
22
|
custom_type_label: string;
|
|
23
23
|
author: {
|
|
@@ -39,13 +39,13 @@ export declare function useDocuments(params: {
|
|
|
39
39
|
} | {
|
|
40
40
|
status: "archived";
|
|
41
41
|
}) & {
|
|
42
|
-
tags: string[];
|
|
43
42
|
version_id: string;
|
|
43
|
+
tags: string[];
|
|
44
44
|
last_modified_date: Date;
|
|
45
|
+
summary?: string | undefined;
|
|
45
46
|
preview_image?: string | undefined;
|
|
46
47
|
uid?: string | undefined;
|
|
47
48
|
custom_type_id?: string | undefined;
|
|
48
|
-
summary?: string | undefined;
|
|
49
49
|
author_ids?: string[] | undefined;
|
|
50
50
|
highlights?: {
|
|
51
51
|
uid?: string | undefined;
|
|
@@ -71,8 +71,8 @@ export declare function useDocuments(params: {
|
|
|
71
71
|
} | {
|
|
72
72
|
status: "archived";
|
|
73
73
|
}) & {
|
|
74
|
-
tags: string[];
|
|
75
74
|
version_id: string;
|
|
75
|
+
tags: string[];
|
|
76
76
|
last_modified_date: Date;
|
|
77
77
|
custom_type_label: string;
|
|
78
78
|
author: {
|
|
@@ -94,13 +94,13 @@ export declare function useDocuments(params: {
|
|
|
94
94
|
} | {
|
|
95
95
|
status: "archived";
|
|
96
96
|
}) & {
|
|
97
|
-
tags: string[];
|
|
98
97
|
version_id: string;
|
|
98
|
+
tags: string[];
|
|
99
99
|
last_modified_date: Date;
|
|
100
|
+
summary?: string | undefined;
|
|
100
101
|
preview_image?: string | undefined;
|
|
101
102
|
uid?: string | undefined;
|
|
102
103
|
custom_type_id?: string | undefined;
|
|
103
|
-
summary?: string | undefined;
|
|
104
104
|
author_ids?: string[] | undefined;
|
|
105
105
|
highlights?: {
|
|
106
106
|
uid?: string | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
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<TContent extends ExtendedRichTextContent> {
|
|
5
5
|
id: string;
|
|
6
|
-
content:
|
|
6
|
+
content: TContent | undefined;
|
|
7
7
|
field: RichText;
|
|
8
8
|
readOnly: boolean;
|
|
9
|
-
onContentChange: (content:
|
|
9
|
+
onContentChange: (content: TContent | undefined) => void;
|
|
10
10
|
}
|
|
11
|
-
export declare function RichTextField(props: Props): JSX.Element;
|
|
11
|
+
export declare function RichTextField<TContent extends ExtendedRichTextContent>(props: Props<TContent>): JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -3,7 +3,7 @@ declare const _default: {
|
|
|
3
3
|
component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
|
|
4
4
|
converter: {
|
|
5
5
|
fromPrismic(schema: Schema<any, any>): (list: {
|
|
6
|
-
type: "
|
|
6
|
+
type: "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "paragraph" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
7
7
|
content: {
|
|
8
8
|
text: string;
|
|
9
9
|
} & {
|
|
@@ -64,7 +64,7 @@ declare const _default: {
|
|
|
64
64
|
direction?: string | undefined;
|
|
65
65
|
}) => ProsemirrorNode | undefined;
|
|
66
66
|
toPrismic(node: ProsemirrorNode, nodeType: "list-item" | "o-list-item"): readonly ({
|
|
67
|
-
type: "
|
|
67
|
+
type: "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "paragraph" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
68
68
|
content: {
|
|
69
69
|
text: string;
|
|
70
70
|
} & {
|
|
@@ -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
|
+
kind: string;
|
|
24
|
+
id: string;
|
|
25
|
+
url: string;
|
|
26
|
+
size: number;
|
|
27
|
+
tags: {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
created_at: number;
|
|
31
|
+
last_modified: number;
|
|
32
|
+
count: number;
|
|
33
|
+
uploader_id?: string | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
last_modified: number;
|
|
36
|
+
filename: string;
|
|
37
|
+
height?: number | undefined;
|
|
38
|
+
width?: 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 {};
|
|
@@ -3,7 +3,7 @@ export declare const NodeUtils: {
|
|
|
3
3
|
isHardBreak(node: ProsemirrorNode): boolean;
|
|
4
4
|
children: {
|
|
5
5
|
reduce<T>(node: ProsemirrorNode, f: (acc: T, child: ProsemirrorNode, index: number) => T, defaultValue: T): T;
|
|
6
|
-
map<T_1>(node: ProsemirrorNode, f: (child: ProsemirrorNode) => T_1): readonly T_1[];
|
|
6
|
+
map<T_1, TReturnReadOnly extends boolean = true>(node: ProsemirrorNode, f: (child: ProsemirrorNode) => T_1): TReturnReadOnly extends true ? readonly T_1[] : T_1[];
|
|
7
7
|
exists(node: ProsemirrorNode, f: (child: ProsemirrorNode) => boolean): boolean;
|
|
8
8
|
filter(node: ProsemirrorNode, predicate: (child: ProsemirrorNode) => boolean): readonly ProsemirrorNode[];
|
|
9
9
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Here live the types to extend RichTextField.
|
|
3
|
+
*
|
|
4
|
+
* Table: The table extension is only used internally by TableBlock. It's not
|
|
5
|
+
* supported by RichText itself, meaning that a user cannot create a table when
|
|
6
|
+
* interacting with RichTextField. It's also not part of the types-internal
|
|
7
|
+
* RichText's types, meaning that we only use these in the frontend, so there is
|
|
8
|
+
* no need to care about RichText table anywhere else.
|
|
9
|
+
*/
|
|
10
|
+
import type { EmbedBlock, ImageBlock, RichTextContent, TableContent, TextBlock } from "@prismicio/types-internal/lib/content";
|
|
11
|
+
export type ExtendedBlock = EmbedBlock | ImageBlock | TextBlock | TableBlock;
|
|
12
|
+
/** Superset of RichTextContent that adds support for TableBlock. */
|
|
13
|
+
export interface ExtendedRichTextContent extends Omit<RichTextContent, "value"> {
|
|
14
|
+
value: ExtendedBlock[];
|
|
15
|
+
}
|
|
16
|
+
export interface TableBlock {
|
|
17
|
+
type: "table";
|
|
18
|
+
content: TableContent["content"];
|
|
19
|
+
}
|
|
20
|
+
export declare function isTableBlock(block: ExtendedBlock): block is TableBlock;
|
|
21
|
+
export declare const ExtendedRichTextNodeType: {
|
|
22
|
+
readonly table: "table";
|
|
23
|
+
readonly heading1: "heading1";
|
|
24
|
+
readonly heading2: "heading2";
|
|
25
|
+
readonly heading3: "heading3";
|
|
26
|
+
readonly heading4: "heading4";
|
|
27
|
+
readonly heading5: "heading5";
|
|
28
|
+
readonly heading6: "heading6";
|
|
29
|
+
readonly paragraph: "paragraph";
|
|
30
|
+
readonly strong: "strong";
|
|
31
|
+
readonly em: "em";
|
|
32
|
+
readonly preformatted: "preformatted";
|
|
33
|
+
readonly hyperlink: "hyperlink";
|
|
34
|
+
readonly image: "image";
|
|
35
|
+
readonly embed: "embed";
|
|
36
|
+
readonly list: "list-item";
|
|
37
|
+
readonly orderedList: "o-list-item";
|
|
38
|
+
readonly rtl: "rtl";
|
|
39
|
+
};
|
|
40
|
+
export type ExtendedRichTextNodeType = (typeof ExtendedRichTextNodeType)[keyof typeof ExtendedRichTextNodeType];
|
|
41
|
+
export declare function isExtendedRichTextNodeTypeSet(set: Set<unknown> | undefined): set is Set<ExtendedRichTextNodeType>;
|