@prismicio/editor-fields 0.4.2 → 0.4.5
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 +6 -0
- package/dist/NestableWidgetSwitch.d.ts +3 -4
- package/dist/SectionEditor.d.ts +3 -4
- package/dist/fields/EmbedField/EmbedField.d.ts +7 -3
- package/dist/fields/GeoPointField.d.ts +11 -0
- package/dist/fields/ImageField/{CroppedDialog/index.d.ts → CropperDialog/CropperDialog.d.ts} +1 -1
- package/dist/fields/ImageField/{CroppedDialog → CropperDialog}/croppedImage.d.ts +1 -1
- package/dist/fields/ImageField/CropperDialog/index.d.ts +1 -0
- package/dist/fields/ImageField/ImageField.d.ts +12 -0
- package/dist/fields/ImageField/MediaPicker/MediaLibrary/MediaLibrary.d.ts +8 -2
- package/dist/fields/ImageField/MediaPicker/MediaLibrary/mediaLibraryData.d.ts +58 -40
- package/dist/fields/ImageField/MediaPicker/MediaPicker.d.ts +2 -2
- package/dist/fields/ImageField/MediaPicker/mediaPickerData.d.ts +22 -0
- package/dist/fields/ImageField/index.d.ts +1 -12
- package/dist/fields/KeyTextField.d.ts +3 -4
- package/dist/fields/LinkField/Documents/DocumentsModal.d.ts +7 -0
- package/dist/fields/LinkField/Documents/documentsData.d.ts +291 -0
- package/dist/fields/LinkField/LinkField.d.ts +11 -0
- package/dist/fields/LinkField/LinkFieldActions.d.ts +5 -2
- package/dist/fields/LinkField/index.d.ts +2 -12
- package/dist/fields/LinkField/useLinkField.d.ts +37 -0
- package/dist/fields/RichTextField/RichTextField.d.ts +2 -2
- package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +4 -4
- package/dist/fields/RichTextField/coreExtensions/Placeholder.d.ts +7 -2
- package/dist/fields/RichTextField/extensions/Embed/EmbedExtension.d.ts +10 -0
- package/dist/fields/RichTextField/extensions/Embed/EmbedView.d.ts +13 -3
- package/dist/fields/RichTextField/extensions/Embed/useEmbedView.d.ts +12 -0
- package/dist/fields/RichTextField/extensions/index.d.ts +1 -1
- package/dist/fields/RichTextField/globalExtensions/TextDirection.d.ts +3 -3
- package/dist/fields/externalLinks.d.ts +2 -0
- package/dist/index.es.js +21349 -19982
- package/dist/index.umd.js +40 -43
- package/dist/slices/SharedSliceEditor.d.ts +3 -4
- package/dist/zones/SliceZoneEditor.d.ts +3 -4
- package/dist/zones/StaticZoneEditor.d.ts +3 -4
- package/package.json +24 -21
- package/dist/fields/ImageField/MediaPicker/MediaLibrary.d.ts +0 -1
- package/dist/fields/ImageField/MediaPicker/UnsplashLibrary.d.ts +0 -6
- package/dist/fields/ImageField/MediaPicker/unsplashData.d.ts +0 -115
- /package/dist/fields/ImageField/{imageField.d.ts → imageFieldUtils.d.ts} +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type FieldSelectTypes = "web" | "document" | "media";
|
|
2
2
|
interface Props {
|
|
3
3
|
hasLink: boolean;
|
|
4
4
|
onUnlink: () => void;
|
|
5
|
+
selectedType?: FieldSelectTypes;
|
|
6
|
+
selectEnabled: boolean;
|
|
7
|
+
onValueChange: (newValue: FieldSelectTypes) => void;
|
|
5
8
|
}
|
|
6
|
-
export declare
|
|
9
|
+
export declare function LinkFieldActions(props: Props): JSX.Element;
|
|
7
10
|
export {};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { FC } from "react";
|
|
4
|
-
declare type LinkFieldProps = Readonly<{
|
|
5
|
-
content: LinkContent | undefined;
|
|
6
|
-
field: Link;
|
|
7
|
-
id: string;
|
|
8
|
-
readOnly: boolean;
|
|
9
|
-
onContentChange: (content: LinkContent | undefined) => void;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const LinkField: FC<LinkFieldProps>;
|
|
12
|
-
export {};
|
|
1
|
+
export { LinkField } from "./LinkField";
|
|
2
|
+
export { LinkFieldActions } from "./LinkFieldActions";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ErrorBoundary } from "@prismicio/editor-ui";
|
|
2
|
+
import type { LinkContent } from "@prismicio/types-internal/lib/content";
|
|
3
|
+
import type { Link } from "@prismicio/types-internal/lib/customtypes";
|
|
4
|
+
import { TypeOf } from "zod";
|
|
5
|
+
import { Env } from "../../EditorConfig";
|
|
6
|
+
import type { FieldSelectTypes } from "./LinkFieldActions";
|
|
7
|
+
export declare function useLinkField(params: {
|
|
8
|
+
field: Link;
|
|
9
|
+
content: LinkContent | undefined;
|
|
10
|
+
onContentChange: (content: LinkContent | undefined) => void;
|
|
11
|
+
}): {
|
|
12
|
+
contentType: "ImageLink" | "FileLink" | "DocumentLink" | "ExternalLink" | undefined;
|
|
13
|
+
selectType: "document" | "media" | "web" | undefined;
|
|
14
|
+
isUnsupportedField: boolean | undefined;
|
|
15
|
+
fieldValue: string;
|
|
16
|
+
onValueChange: (value: string) => void;
|
|
17
|
+
onTypeChange: (newValue: FieldSelectTypes) => void;
|
|
18
|
+
placeholder: string;
|
|
19
|
+
isTypeSelectEnabled: boolean;
|
|
20
|
+
onDocumentSelected: (documentId: string) => void;
|
|
21
|
+
onError: () => void;
|
|
22
|
+
errorBoundaryRef: import("react").RefObject<ErrorBoundary>;
|
|
23
|
+
};
|
|
24
|
+
export declare function useDocumentTitle(id: string): string;
|
|
25
|
+
declare const documentMeta: import("zod").ZodObject<{
|
|
26
|
+
id: import("zod").ZodString;
|
|
27
|
+
title: import("zod").ZodString;
|
|
28
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
}, {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare type DocumentMeta = TypeOf<typeof documentMeta>;
|
|
36
|
+
export declare function getDocumentTitleRequest(baseUrl: string | undefined, env: Env, id: string): Promise<DocumentMeta>;
|
|
37
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { RichTextContent } from "@prismicio/types-internal/lib/content";
|
|
2
2
|
import type { RichText } from "@prismicio/types-internal/lib/customtypes";
|
|
3
3
|
import { type FC } from "react";
|
|
4
|
-
|
|
4
|
+
interface RichTextFieldProps {
|
|
5
5
|
content: RichTextContent | undefined;
|
|
6
6
|
field: RichText;
|
|
7
7
|
id: string;
|
|
8
8
|
onContentChange: (content: RichTextContent | undefined) => void;
|
|
9
9
|
readOnly: boolean;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
export declare const RichTextField: FC<RichTextFieldProps>;
|
|
12
12
|
export {};
|
|
@@ -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: "em" | "embed" | "strong" | "image" | "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: "label" | "em" | "embed" | "strong" | "image" | "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: "em" | "embed" | "strong" | "image" | "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: "label" | "em" | "embed" | "strong" | "image" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
|
|
34
34
|
})[] | undefined;
|
|
35
35
|
};
|
|
36
36
|
} & {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { type ExtensionPlaceholder } from "../models";
|
|
2
|
-
|
|
1
|
+
import { type ExtensionPlaceholder, NodeExtension } from "../models";
|
|
2
|
+
interface PlaceholderParams {
|
|
3
|
+
placeholderByNodeType: Record<string, ExtensionPlaceholder>;
|
|
4
|
+
unfocusedPlaceholder: string | undefined;
|
|
5
|
+
nodeExtensions: readonly NodeExtension[];
|
|
6
|
+
}
|
|
7
|
+
declare const _default: (params: PlaceholderParams) => import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any>;
|
|
3
8
|
export default _default;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { EmbedContent } from "@prismicio/types-internal/lib/content";
|
|
2
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
3
|
+
import { NodeViewProps } from "@tiptap/react";
|
|
4
|
+
interface EmbedNode extends ProseMirrorNode {
|
|
5
|
+
attrs: {
|
|
6
|
+
content: EmbedContent | undefined;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface EmbedViewProps extends NodeViewProps {
|
|
10
|
+
node: EmbedNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function EmbedView(props: EmbedViewProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EmbedContent } from "@prismicio/types-internal/lib/content";
|
|
2
|
+
import { KeyboardEvent, RefObject } from "react";
|
|
3
|
+
import type { EmbedViewProps } from "./EmbedView";
|
|
4
|
+
export declare function useEmbedView(props: EmbedViewProps, inputRef: RefObject<HTMLInputElement>, containerRef: RefObject<HTMLDivElement>): {
|
|
5
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
6
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
7
|
+
onKeyDown: (event: KeyboardEvent<Element>) => void;
|
|
8
|
+
url: string;
|
|
9
|
+
urlChanged: (url: string) => void;
|
|
10
|
+
onContentChange: (content?: EmbedContent) => void;
|
|
11
|
+
debouncedUrl: string;
|
|
12
|
+
};
|
|
@@ -3,7 +3,7 @@ import type { WidgetExtension } from "../models";
|
|
|
3
3
|
import { default as Bold } from "./Bold";
|
|
4
4
|
import { default as BulletList } from "./BulletList";
|
|
5
5
|
import { default as CodeBlock } from "./CodeBlock";
|
|
6
|
-
import { default as Embed } from "./Embed";
|
|
6
|
+
import { default as Embed } from "./Embed/EmbedExtension";
|
|
7
7
|
import { default as Heading } from "./Heading";
|
|
8
8
|
import { default as Italic } from "./Italic";
|
|
9
9
|
import { default as OrderedList } from "./OrderedList";
|
|
@@ -8,10 +8,10 @@ export declare enum Direction {
|
|
|
8
8
|
interface TextDirectionOptions {
|
|
9
9
|
supportedExtensionNames: readonly string[];
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const attrName = "dir";
|
|
12
12
|
declare module "@tiptap/core" {
|
|
13
13
|
interface Commands<ReturnType> {
|
|
14
|
-
[
|
|
14
|
+
[attrName]: {
|
|
15
15
|
setDirection: (direction: Direction) => ReturnType;
|
|
16
16
|
toggleDirection: (direction: Direction) => ReturnType;
|
|
17
17
|
/**
|
|
@@ -30,7 +30,7 @@ export declare const component: Extension<TextDirectionOptions, any>;
|
|
|
30
30
|
export declare const converter: {
|
|
31
31
|
parseNodeAttrsDirection(attributes: Record<string, unknown>): Direction;
|
|
32
32
|
fromPrismic(textBlock: TextBlock): {
|
|
33
|
-
[
|
|
33
|
+
[attrName]: Direction;
|
|
34
34
|
};
|
|
35
35
|
toPrismic(node: ProsemirrorNode): {
|
|
36
36
|
direction: Direction;
|