@prismicio/editor-fields 0.4.0 → 0.4.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/EditorConfig.d.ts +4 -0
- package/dist/fields/ImageField/MediaPicker/MediaLibrary/MediaLibrary.d.ts +6 -0
- package/dist/fields/ImageField/MediaPicker/MediaLibrary/index.d.ts +1 -0
- package/dist/fields/ImageField/MediaPicker/MediaLibrary/mediaLibraryData.d.ts +100 -0
- package/dist/fields/ImageField/MediaPicker/MediaLibrary.d.ts +1 -0
- package/dist/fields/ImageField/MediaPicker/MediaPicker.d.ts +8 -0
- package/dist/fields/ImageField/MediaPicker/UnsplashLibrary/UnsplashLibrary.d.ts +6 -0
- package/dist/fields/ImageField/MediaPicker/UnsplashLibrary/index.d.ts +1 -0
- package/dist/fields/ImageField/MediaPicker/UnsplashLibrary/unsplashData.d.ts +115 -0
- package/dist/fields/ImageField/MediaPicker/UnsplashLibrary.d.ts +6 -0
- package/dist/fields/ImageField/MediaPicker/index.d.ts +1 -8
- package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +4 -4
- package/dist/fields/UIDField/UIDField.d.ts +10 -0
- package/dist/fields/UIDField/index.d.ts +1 -0
- package/dist/fields/UIDField/uidUtils.d.ts +1 -0
- package/dist/fields/utils.d.ts +4 -3
- package/dist/index.es.js +13717 -13550
- package/dist/index.umd.js +33 -33
- package/package.json +5 -5
package/dist/EditorConfig.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export interface EditorConfig {
|
|
|
5
5
|
unsplash: {
|
|
6
6
|
url: string;
|
|
7
7
|
};
|
|
8
|
+
assets?: {
|
|
9
|
+
url: string;
|
|
10
|
+
repository: string;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
13
|
export declare const EditorConfigContext: import("react").Context<EditorConfig | undefined>;
|
|
10
14
|
export declare function useEditorConfig(): EditorConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MediaLibrary } from "./MediaLibrary";
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { TypeOf } from "zod";
|
|
2
|
+
declare const mediaLibraryImage: import("zod").ZodObject<{
|
|
3
|
+
id: import("zod").ZodString;
|
|
4
|
+
kind: import("zod").ZodString;
|
|
5
|
+
extension: import("zod").ZodString;
|
|
6
|
+
filename: import("zod").ZodString;
|
|
7
|
+
width: import("zod").ZodNumber;
|
|
8
|
+
height: import("zod").ZodNumber;
|
|
9
|
+
last_modified: import("zod").ZodNumber;
|
|
10
|
+
url: import("zod").ZodString;
|
|
11
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
extension: string;
|
|
15
|
+
filename: string;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
last_modified: number;
|
|
19
|
+
url: string;
|
|
20
|
+
}, {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
extension: string;
|
|
24
|
+
filename: string;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
last_modified: number;
|
|
28
|
+
url: string;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const mediaLibrarySearchAPISchema: import("zod").ZodObject<{
|
|
31
|
+
total: import("zod").ZodNumber;
|
|
32
|
+
cursor: import("zod").ZodString;
|
|
33
|
+
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
34
|
+
id: import("zod").ZodString;
|
|
35
|
+
kind: import("zod").ZodString;
|
|
36
|
+
extension: import("zod").ZodString;
|
|
37
|
+
filename: import("zod").ZodString;
|
|
38
|
+
width: import("zod").ZodNumber;
|
|
39
|
+
height: import("zod").ZodNumber;
|
|
40
|
+
last_modified: import("zod").ZodNumber;
|
|
41
|
+
url: import("zod").ZodString;
|
|
42
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
43
|
+
id: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
extension: string;
|
|
46
|
+
filename: string;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
last_modified: number;
|
|
50
|
+
url: string;
|
|
51
|
+
}, {
|
|
52
|
+
id: string;
|
|
53
|
+
kind: string;
|
|
54
|
+
extension: string;
|
|
55
|
+
filename: string;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
last_modified: number;
|
|
59
|
+
url: string;
|
|
60
|
+
}>, "many">;
|
|
61
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
62
|
+
total: number;
|
|
63
|
+
cursor: string;
|
|
64
|
+
items: {
|
|
65
|
+
id: string;
|
|
66
|
+
kind: string;
|
|
67
|
+
extension: string;
|
|
68
|
+
filename: string;
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
last_modified: number;
|
|
72
|
+
url: string;
|
|
73
|
+
}[];
|
|
74
|
+
}, {
|
|
75
|
+
total: number;
|
|
76
|
+
cursor: string;
|
|
77
|
+
items: {
|
|
78
|
+
id: string;
|
|
79
|
+
kind: string;
|
|
80
|
+
extension: string;
|
|
81
|
+
filename: string;
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
last_modified: number;
|
|
85
|
+
url: string;
|
|
86
|
+
}[];
|
|
87
|
+
}>;
|
|
88
|
+
export declare type MediaLibrarySearchApi = TypeOf<typeof mediaLibrarySearchAPISchema>;
|
|
89
|
+
export declare type MediaLibraryImage = TypeOf<typeof mediaLibraryImage>;
|
|
90
|
+
export declare function useMediaLibrarySearch(url: string, repository: string): {
|
|
91
|
+
id: string;
|
|
92
|
+
kind: string;
|
|
93
|
+
extension: string;
|
|
94
|
+
filename: string;
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
last_modified: number;
|
|
98
|
+
url: string;
|
|
99
|
+
}[];
|
|
100
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MediaLibrary: () => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import type { ExternalImage } from "./externalImage";
|
|
3
|
+
interface MediaPickerProps {
|
|
4
|
+
trigger: ReactNode;
|
|
5
|
+
onMediaSelected: (media: ExternalImage) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const MediaPicker: FC<MediaPickerProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnsplashLibrary } from "./UnsplashLibrary";
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { TypeOf } from "zod";
|
|
2
|
+
declare const unsplashImage: import("zod").ZodObject<{
|
|
3
|
+
id: import("zod").ZodString;
|
|
4
|
+
width: import("zod").ZodNumber;
|
|
5
|
+
height: import("zod").ZodNumber;
|
|
6
|
+
urls: import("zod").ZodObject<{
|
|
7
|
+
full: import("zod").ZodString;
|
|
8
|
+
small: import("zod").ZodEffects<import("zod").ZodString, string, string>;
|
|
9
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
10
|
+
small: string;
|
|
11
|
+
full: string;
|
|
12
|
+
}, {
|
|
13
|
+
small: string;
|
|
14
|
+
full: string;
|
|
15
|
+
}>;
|
|
16
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
17
|
+
id: string;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
urls: {
|
|
21
|
+
small: string;
|
|
22
|
+
full: string;
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
id: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
urls: {
|
|
29
|
+
small: string;
|
|
30
|
+
full: string;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
export declare const unsplashSearchApiType: import("zod").ZodEffects<import("zod").ZodObject<{
|
|
34
|
+
results: import("zod").ZodArray<import("zod").ZodObject<{
|
|
35
|
+
id: import("zod").ZodString;
|
|
36
|
+
width: import("zod").ZodNumber;
|
|
37
|
+
height: import("zod").ZodNumber;
|
|
38
|
+
urls: import("zod").ZodObject<{
|
|
39
|
+
full: import("zod").ZodString;
|
|
40
|
+
small: import("zod").ZodEffects<import("zod").ZodString, string, string>;
|
|
41
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
42
|
+
small: string;
|
|
43
|
+
full: string;
|
|
44
|
+
}, {
|
|
45
|
+
small: string;
|
|
46
|
+
full: string;
|
|
47
|
+
}>;
|
|
48
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
49
|
+
id: string;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
urls: {
|
|
53
|
+
small: string;
|
|
54
|
+
full: string;
|
|
55
|
+
};
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
urls: {
|
|
61
|
+
small: string;
|
|
62
|
+
full: string;
|
|
63
|
+
};
|
|
64
|
+
}>, "many">;
|
|
65
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
66
|
+
results: {
|
|
67
|
+
id: string;
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
urls: {
|
|
71
|
+
small: string;
|
|
72
|
+
full: string;
|
|
73
|
+
};
|
|
74
|
+
}[];
|
|
75
|
+
}, {
|
|
76
|
+
results: {
|
|
77
|
+
id: string;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
urls: {
|
|
81
|
+
small: string;
|
|
82
|
+
full: string;
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
}>, {
|
|
86
|
+
id: string;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
urls: {
|
|
90
|
+
small: string;
|
|
91
|
+
full: string;
|
|
92
|
+
};
|
|
93
|
+
}[], {
|
|
94
|
+
results: {
|
|
95
|
+
id: string;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
urls: {
|
|
99
|
+
small: string;
|
|
100
|
+
full: string;
|
|
101
|
+
};
|
|
102
|
+
}[];
|
|
103
|
+
}>;
|
|
104
|
+
export declare type UnplashSearchApi = TypeOf<typeof unsplashSearchApiType>;
|
|
105
|
+
export declare type UnsplashImage = TypeOf<typeof unsplashImage>;
|
|
106
|
+
export declare function useUnsplashSearch(baseUrl: string, term: string): {
|
|
107
|
+
id: string;
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
urls: {
|
|
111
|
+
small: string;
|
|
112
|
+
full: string;
|
|
113
|
+
};
|
|
114
|
+
}[];
|
|
115
|
+
export {};
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ExternalImage } from "./externalImage";
|
|
3
|
-
interface MediaPickerProps {
|
|
4
|
-
trigger: ReactNode;
|
|
5
|
-
onMediaSelected?: (media: ExternalImage) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const MediaPicker: FC<MediaPickerProps>;
|
|
8
|
-
export {};
|
|
1
|
+
export { MediaPicker } from "./MediaPicker";
|
|
@@ -4,7 +4,7 @@ declare const _default: {
|
|
|
4
4
|
component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
|
|
5
5
|
converter: {
|
|
6
6
|
fromPrismic(schema: Schema<any, any>): (list: {
|
|
7
|
-
type: "
|
|
7
|
+
type: "image" | "em" | "embed" | "strong" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
|
|
8
8
|
content: {
|
|
9
9
|
text: string;
|
|
10
10
|
} & {
|
|
@@ -13,7 +13,7 @@ declare const _default: {
|
|
|
13
13
|
} & {
|
|
14
14
|
start: number;
|
|
15
15
|
end: number;
|
|
16
|
-
type: "
|
|
16
|
+
type: "image" | "em" | "embed" | "label" | "strong" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
|
|
17
17
|
})[] | undefined;
|
|
18
18
|
};
|
|
19
19
|
} & {
|
|
@@ -21,7 +21,7 @@ declare const _default: {
|
|
|
21
21
|
direction?: string | undefined;
|
|
22
22
|
}) => ProsemirrorNode | undefined;
|
|
23
23
|
toPrismic(node: ProsemirrorNode, nodeType: "list-item" | "o-list-item"): readonly ({
|
|
24
|
-
type: "
|
|
24
|
+
type: "image" | "em" | "embed" | "strong" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
|
|
25
25
|
content: {
|
|
26
26
|
text: string;
|
|
27
27
|
} & {
|
|
@@ -30,7 +30,7 @@ declare const _default: {
|
|
|
30
30
|
} & {
|
|
31
31
|
start: number;
|
|
32
32
|
end: number;
|
|
33
|
-
type: "
|
|
33
|
+
type: "image" | "em" | "embed" | "label" | "strong" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
|
|
34
34
|
})[] | undefined;
|
|
35
35
|
};
|
|
36
36
|
} & {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UIDContent } from "@prismicio/types-internal/lib/content";
|
|
2
|
+
import type { UID as UIDType } from "@prismicio/types-internal/lib/customtypes";
|
|
3
|
+
declare type Props = Readonly<{
|
|
4
|
+
id: string;
|
|
5
|
+
content?: UIDContent;
|
|
6
|
+
field: UIDType;
|
|
7
|
+
onContentChange: (content?: UIDContent) => void;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const UIDField: ({ id, field, content, onContentChange }: Props) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UIDField } from "./UIDField";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const slugifyUID: (input: string) => string;
|
package/dist/fields/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { BooleanField, NestableWidget, Separator } from "@prismicio/types-internal/lib/customtypes";
|
|
2
|
-
declare type
|
|
3
|
-
|
|
1
|
+
import type { BooleanField, NestableWidget, Separator, UID } from "@prismicio/types-internal/lib/customtypes";
|
|
2
|
+
declare type Widgets = NestableWidget | UID;
|
|
3
|
+
declare type Field = Exclude<Widgets, Separator>;
|
|
4
|
+
export declare function getFieldLabel(field: Widgets): string;
|
|
4
5
|
export declare function getFieldPlaceholder(field: Exclude<Field, BooleanField>): string;
|
|
5
6
|
export declare function getFieldPlaceholder(field: BooleanField, value: boolean): string;
|
|
6
7
|
export {};
|