@prismicio/editor-fields 0.4.10 → 0.4.14

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.
Files changed (70) hide show
  1. package/dist/DocumentEditor.d.ts +4 -7
  2. package/dist/EditorConfig.d.ts +15 -5
  3. package/dist/GroupEditor.d.ts +1 -1
  4. package/dist/Selection.d.ts +25 -3
  5. package/dist/UID.d.ts +5 -0
  6. package/dist/constants/images.d.ts +8 -0
  7. package/dist/fields/EmbedField/EmbedFooter.d.ts +2 -2
  8. package/dist/fields/GeoPointField/geoPointFieldUtils.d.ts +1 -1
  9. package/dist/fields/ImageField/Components/EmptyCardContent.d.ts +2 -2
  10. package/dist/fields/ImageField/Components/ImageFieldCard.d.ts +4 -4
  11. package/dist/fields/ImageField/CropperDialog/CropperDialog.d.ts +1 -1
  12. package/dist/fields/ImageField/CropperDialog/croppedImage.d.ts +2 -2
  13. package/dist/fields/ImageField/MediaPicker/MediaLibrary/MediaLibrary.d.ts +5 -5
  14. package/dist/fields/ImageField/MediaPicker/MediaLibrary/mediaLibraryData.d.ts +28 -6
  15. package/dist/fields/ImageField/MediaPicker/MediaPicker.d.ts +5 -4
  16. package/dist/fields/ImageField/MediaPicker/UnsplashLibrary/unsplashData.d.ts +14 -3
  17. package/dist/fields/ImageField/MediaPicker/externalImage.d.ts +3 -2
  18. package/dist/fields/ImageField/MediaPicker/mediaPickerData.d.ts +10 -12
  19. package/dist/fields/ImageField/imageFieldUtils.d.ts +1 -1
  20. package/dist/fields/ImageField/useImageField.d.ts +2 -2
  21. package/dist/fields/LinkField/Documents/DocumentsModal.d.ts +6 -0
  22. package/dist/fields/LinkField/Documents/Filters.d.ts +1 -1
  23. package/dist/fields/LinkField/Documents/documentsData.d.ts +10 -0
  24. package/dist/fields/LinkField/Documents/useFilters.d.ts +5 -3
  25. package/dist/fields/LinkField/LinkFieldActions.d.ts +1 -1
  26. package/dist/fields/LinkField/index.d.ts +1 -0
  27. package/dist/fields/LinkField/useLinkField.d.ts +48 -4
  28. package/dist/fields/NumberField.d.ts +1 -1
  29. package/dist/fields/RichTextField/BubbleMenu/BubbleMenu.d.ts +1 -0
  30. package/dist/fields/RichTextField/BubbleMenu/Link/DocumentDescriptionCard.d.ts +7 -0
  31. package/dist/fields/RichTextField/BubbleMenu/Link/LinkItems.d.ts +2 -1
  32. package/dist/fields/RichTextField/BubbleMenu/Link/LinkPopover.d.ts +10 -2
  33. package/dist/fields/RichTextField/BubbleMenu/Link/SetDocumentLinkModal.d.ts +8 -0
  34. package/dist/fields/RichTextField/BubbleMenu/Link/SetMediaLinkModal.d.ts +8 -0
  35. package/dist/fields/RichTextField/BubbleMenu/Link/{SetLinkModal.d.ts → SetWebLinkModal.d.ts} +2 -2
  36. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +99 -8
  37. package/dist/fields/RichTextField/coreExtensions/Placeholder.d.ts +1 -1
  38. package/dist/fields/RichTextField/coreExtensions/index.d.ts +3 -2
  39. package/dist/fields/RichTextField/extensions/Bold/Bold.d.ts +2 -2
  40. package/dist/fields/RichTextField/extensions/Bold/BoldModel.d.ts +23 -0
  41. package/dist/fields/RichTextField/extensions/Embed/EmbedView.d.ts +1 -1
  42. package/dist/fields/RichTextField/extensions/Embed/useEmbedView.d.ts +21 -2
  43. package/dist/fields/RichTextField/extensions/Heading/Heading.d.ts +3 -4
  44. package/dist/fields/RichTextField/extensions/Image/ImageView.d.ts +1 -1
  45. package/dist/fields/RichTextField/extensions/Image/useImageView.d.ts +2 -2
  46. package/dist/fields/RichTextField/extensions/Italic/Italic.d.ts +2 -2
  47. package/dist/fields/RichTextField/extensions/Italic/ItalicModel.d.ts +23 -0
  48. package/dist/fields/RichTextField/extensions/Link/Link.d.ts +35 -0
  49. package/dist/fields/RichTextField/extensions/Link/LinkModel.d.ts +58 -0
  50. package/dist/fields/RichTextField/extensions/extensions.d.ts +2 -2
  51. package/dist/fields/RichTextField/models/EditorExtension.d.ts +18 -30
  52. package/dist/fields/RichTextField/models/MenuItems.d.ts +2 -2
  53. package/dist/fields/RichTextField/models/RichTextConfig.d.ts +49 -3
  54. package/dist/fields/RichTextField/models/Span.d.ts +88 -4
  55. package/dist/fields/RichTextField/useEditor.d.ts +6 -1
  56. package/dist/fields/UIDField/UIDField.d.ts +3 -3
  57. package/dist/fields/utils.d.ts +2 -2
  58. package/dist/index.d.ts +3 -1
  59. package/dist/index.es.js +33142 -32807
  60. package/dist/slices/CompositeSliceEditor.d.ts +4 -4
  61. package/dist/slices/LegacySliceEditor.d.ts +4 -4
  62. package/dist/slices/SharedSliceEditor.d.ts +4 -2
  63. package/dist/slices/defaults.d.ts +23 -0
  64. package/dist/slices/utils.d.ts +34 -0
  65. package/dist/zones/NonRepeatableZoneEditor.d.ts +4 -5
  66. package/dist/zones/SliceZoneEditor.d.ts +0 -1
  67. package/dist/zones/StaticZone.d.ts +2 -2
  68. package/package.json +6 -7
  69. package/dist/fields/RichTextField/extensions/Link.d.ts +0 -2
  70. package/dist/fields/UIDField/uidUtils.d.ts +0 -1
@@ -1,8 +1,9 @@
1
1
  import type { ErrorBoundary } from "@prismicio/editor-ui";
2
2
  import type { LinkContent } from "@prismicio/types-internal/lib/content";
3
3
  import type { Link } from "@prismicio/types-internal/lib/customtypes";
4
- import { TypeOf } from "zod";
5
- import { Env } from "../../EditorConfig";
4
+ import { type TypeOf } from "zod";
5
+ import { type Env } from "../../EditorConfig";
6
+ import { type MediaAssetOrExternalImage } from "../ImageField/MediaPicker/MediaLibrary/mediaLibraryData";
6
7
  import type { FieldSelectTypes } from "./LinkFieldActions";
7
8
  interface useLinkFieldParams {
8
9
  field: Link;
@@ -12,7 +13,6 @@ interface useLinkFieldParams {
12
13
  export declare function useLinkField(params: useLinkFieldParams): {
13
14
  contentType: "ImageLink" | "FileLink" | "DocumentLink" | "ExternalLink" | undefined;
14
15
  selectType: "media" | "web" | "document" | undefined;
15
- isUnsupportedField: boolean | undefined;
16
16
  fieldValue: string;
17
17
  onValueChange: (value: string) => void;
18
18
  onTypeChange: (newValue: FieldSelectTypes) => void;
@@ -23,6 +23,7 @@ export declare function useLinkField(params: useLinkFieldParams): {
23
23
  errorBoundaryRef: import("react").RefObject<ErrorBoundary>;
24
24
  isTargetNewTab: boolean;
25
25
  updateWebLinkTarget: (newTab: boolean) => void;
26
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
26
27
  };
27
28
  export declare function useDocumentTitle(id: string): string;
28
29
  declare const documentMeta: import("zod").ZodObject<{
@@ -35,6 +36,49 @@ declare const documentMeta: import("zod").ZodObject<{
35
36
  id: string;
36
37
  title: string;
37
38
  }>;
38
- export declare type DocumentMeta = TypeOf<typeof documentMeta>;
39
+ export type DocumentMeta = TypeOf<typeof documentMeta>;
39
40
  export declare function getDocumentTitleRequest(baseUrl: string, env: Env, id: string): Promise<DocumentMeta>;
41
+ interface MapMediaToLinkContentArgs {
42
+ media: MediaAssetOrExternalImage;
43
+ }
44
+ export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs): {
45
+ __TYPE__: "LinkContent";
46
+ value: {
47
+ __TYPE__: "FileLink";
48
+ id: string;
49
+ name: string;
50
+ kind: string;
51
+ url: string;
52
+ size: string;
53
+ date: string;
54
+ height?: undefined;
55
+ width?: undefined;
56
+ };
57
+ } | {
58
+ __TYPE__: "LinkContent";
59
+ value: {
60
+ __TYPE__: "ImageLink";
61
+ id: string;
62
+ name: string;
63
+ url: string;
64
+ kind: string;
65
+ size: string;
66
+ height: string;
67
+ width: string;
68
+ date: string;
69
+ };
70
+ } | {
71
+ __TYPE__: "LinkContent";
72
+ value: {
73
+ __TYPE__: "ImageLink";
74
+ id: string;
75
+ name: string;
76
+ kind: string;
77
+ url: string;
78
+ size: string;
79
+ height: string;
80
+ width: string;
81
+ date?: undefined;
82
+ };
83
+ };
40
84
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { NumberContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Number as NumberT } from "@prismicio/types-internal/lib/customtypes";
3
3
  import type { FC } from "react";
4
- declare type NumberFieldProps = Readonly<{
4
+ type NumberFieldProps = Readonly<{
5
5
  content: NumberContent | undefined;
6
6
  field: NumberT;
7
7
  id: string;
@@ -3,5 +3,6 @@ interface BubbleMenuProps {
3
3
  editor: Editor;
4
4
  nodeTypes: string[];
5
5
  }
6
+ export type Modal = "webLink" | "documentLink" | "mediaLink" | undefined;
6
7
  export declare function BubbleMenu(props: BubbleMenuProps): JSX.Element;
7
8
  export {};
@@ -0,0 +1,7 @@
1
+ interface DocumentDescriptionCardProps {
2
+ docId: string;
3
+ onEdit: () => void;
4
+ onUnlink: () => void;
5
+ }
6
+ export declare function DocumentDescriptionCard(props: DocumentDescriptionCardProps): JSX.Element | null;
7
+ export {};
@@ -1,8 +1,9 @@
1
1
  import type { Editor } from "@tiptap/core";
2
2
  import type { MutableRefObject } from "react";
3
+ import type { Modal } from "../BubbleMenu";
3
4
  interface LinkItemsProps {
4
5
  editor: Editor;
5
- setDisplayLinkModal: (open: boolean) => void;
6
+ setModal: (modal: Modal) => void;
6
7
  bubbleMenuContainerRef?: MutableRefObject<null>;
7
8
  }
8
9
  export declare function LinkItems(props: LinkItemsProps): JSX.Element;
@@ -1,7 +1,15 @@
1
1
  import type { Editor } from "@tiptap/core";
2
2
  interface LinkPopoverProps {
3
3
  editor: Editor;
4
- onEdit: () => void;
4
+ onEditWebLink: () => void;
5
+ onEditDocumentLink: () => void;
6
+ onEditMediaLink: () => void;
5
7
  }
6
- export declare function LinkPopover(props: LinkPopoverProps): JSX.Element;
8
+ export declare function LinkPopover(props: LinkPopoverProps): JSX.Element | null;
9
+ interface DocumentLinkPopoverProps {
10
+ editor: Editor;
11
+ onEditDocumentLink: () => void;
12
+ docId: string;
13
+ }
14
+ export declare function DocumentLinkPopover(props: DocumentLinkPopoverProps): JSX.Element;
7
15
  export {};
@@ -0,0 +1,8 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ interface SetDocumentLinkModalProps {
3
+ open: boolean;
4
+ setOpen: (open: boolean) => void;
5
+ editor: Editor;
6
+ }
7
+ export declare function SetDocumentLinkModal(props: SetDocumentLinkModalProps): JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ interface SetMediaLinkModalProps {
3
+ open: boolean;
4
+ setOpen: (open: boolean) => void;
5
+ editor: Editor;
6
+ }
7
+ export declare function SetMediaLinkModal(props: SetMediaLinkModalProps): JSX.Element;
8
+ export {};
@@ -1,8 +1,8 @@
1
1
  import type { Editor } from "@tiptap/core";
2
- interface SetLinkModalProps {
2
+ interface SetWebLinkModalProps {
3
3
  open: boolean;
4
4
  setOpen: (open: boolean) => void;
5
5
  editor: Editor;
6
6
  }
7
- export declare function SetLinkModal(props: SetLinkModalProps): JSX.Element;
7
+ export declare function SetWebLinkModal(props: SetWebLinkModalProps): JSX.Element;
8
8
  export {};
@@ -1,4 +1,3 @@
1
- import type { ReadonlyNonEmptyArray } from "fp-ts/ReadonlyNonEmptyArray";
2
1
  import type { Node as ProsemirrorNode, Schema } from "prosemirror-model";
3
2
  declare const _default: {
4
3
  component: import("@tiptap/core").Node<import("@tiptap/extension-list-item").ListItemOptions, any>;
@@ -9,11 +8,57 @@ declare const _default: {
9
8
  text: string;
10
9
  } & {
11
10
  spans?: ({
12
- data?: unknown;
13
- } & {
11
+ data: ({
12
+ __TYPE__: "ImageLink";
13
+ } & {
14
+ id: string;
15
+ url: string;
16
+ height: string;
17
+ width: string;
18
+ size: string;
19
+ name: string;
20
+ kind: string;
21
+ } & {
22
+ date?: string | null | undefined;
23
+ }) | ({
24
+ id: string;
25
+ url: string;
26
+ name: string;
27
+ kind: string;
28
+ size: string;
29
+ } & {
30
+ date?: string | null | undefined;
31
+ } & {
32
+ __TYPE__: "FileLink";
33
+ } & {
34
+ size?: string | undefined;
35
+ }) | ({
36
+ __TYPE__: "DocumentLink";
37
+ } & {
38
+ id: string;
39
+ }) | ({
40
+ __TYPE__: "ExternalLink";
41
+ } & {
42
+ url: string;
43
+ } & {
44
+ kind?: "web" | undefined;
45
+ target?: string | null | undefined;
46
+ preview?: {
47
+ title?: string | undefined;
48
+ } | null | undefined;
49
+ });
14
50
  start: number;
15
51
  end: number;
16
- type: "label" | "em" | "embed" | "strong" | "image" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
52
+ type: "hyperlink";
53
+ } | {
54
+ data: string;
55
+ start: number;
56
+ end: number;
57
+ type: "label";
58
+ } | {
59
+ start: number;
60
+ end: number;
61
+ type: "em" | "strong" | "list-item";
17
62
  })[] | undefined;
18
63
  };
19
64
  } & {
@@ -26,11 +71,57 @@ declare const _default: {
26
71
  text: string;
27
72
  } & {
28
73
  spans?: ({
29
- data?: unknown;
30
- } & {
74
+ data: ({
75
+ __TYPE__: "ImageLink";
76
+ } & {
77
+ id: string;
78
+ url: string;
79
+ height: string;
80
+ width: string;
81
+ size: string;
82
+ name: string;
83
+ kind: string;
84
+ } & {
85
+ date?: string | null | undefined;
86
+ }) | ({
87
+ id: string;
88
+ url: string;
89
+ name: string;
90
+ kind: string;
91
+ size: string;
92
+ } & {
93
+ date?: string | null | undefined;
94
+ } & {
95
+ __TYPE__: "FileLink";
96
+ } & {
97
+ size?: string | undefined;
98
+ }) | ({
99
+ __TYPE__: "DocumentLink";
100
+ } & {
101
+ id: string;
102
+ }) | ({
103
+ __TYPE__: "ExternalLink";
104
+ } & {
105
+ url: string;
106
+ } & {
107
+ kind?: "web" | undefined;
108
+ target?: string | null | undefined;
109
+ preview?: {
110
+ title?: string | undefined;
111
+ } | null | undefined;
112
+ });
113
+ start: number;
114
+ end: number;
115
+ type: "hyperlink";
116
+ } | {
117
+ data: string;
118
+ start: number;
119
+ end: number;
120
+ type: "label";
121
+ } | {
31
122
  start: number;
32
123
  end: number;
33
- type: "label" | "em" | "embed" | "strong" | "image" | "paragraph" | "list-item" | "o-list-item" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "preformatted" | "hyperlink" | "rtl";
124
+ type: "em" | "strong" | "list-item";
34
125
  })[] | undefined;
35
126
  };
36
127
  } & {
@@ -41,4 +132,4 @@ declare const _default: {
41
132
  placeholder: string;
42
133
  };
43
134
  export default _default;
44
- export declare function mergeLists(lists: ReadonlyNonEmptyArray<ProsemirrorNode>): ProsemirrorNode | undefined;
135
+ export declare function mergeLists(previousNode: ProsemirrorNode, newNode: ProsemirrorNode): ProsemirrorNode | undefined;
@@ -1,4 +1,4 @@
1
- import { type ExtensionPlaceholder, NodeExtension } from "../models";
1
+ import { type ExtensionPlaceholder, type NodeExtension } from "../models";
2
2
  interface PlaceholderParams {
3
3
  placeholderByNodeType: Record<string, ExtensionPlaceholder>;
4
4
  unfocusedPlaceholder: string | undefined;
@@ -1,9 +1,10 @@
1
1
  import { type RichText } from "@prismicio/types-internal/lib/customtypes";
2
- import type { Node } from "@tiptap/core";
3
2
  import { type NodeExtension } from "../models";
4
3
  import { default as Document } from "./Document";
5
4
  import { default as HardBreak } from "./HardBreak";
6
5
  import { default as ListItem } from "./ListItem";
7
6
  import { default as Text } from "./Text";
8
- export declare function CoreComponents(field: RichText, nodeExtensions: readonly NodeExtension[]): readonly Node[];
7
+ export declare function CoreComponents(field: RichText, nodeExtensions: NodeExtension[]): NonNullable<import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any> | import("@tiptap/core").Extension<Readonly<{
8
+ nodeTypes: readonly string[];
9
+ }>, any> | undefined>[];
9
10
  export { Document, HardBreak, ListItem, Text };
@@ -1,3 +1,3 @@
1
- import { MarkExtension } from "../../models/EditorExtension";
2
- declare const EditorBold: MarkExtension<unknown>;
1
+ import { BoldExtension } from "./BoldModel";
2
+ declare const EditorBold: BoldExtension;
3
3
  export default EditorBold;
@@ -0,0 +1,23 @@
1
+ import type { Mark } from "@tiptap/core";
2
+ import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
3
+ import { ExtensionType } from "../../models";
4
+ export declare class BoldExtension {
5
+ readonly name: string;
6
+ readonly component: Mark;
7
+ readonly converter: {
8
+ fromPrismic(schema: Schema): (elmt: BoldElement) => ProsemirrorMark | undefined;
9
+ toPrismic(elmt: ProsemirrorMark): undefined;
10
+ };
11
+ extType: ExtensionType.Mark;
12
+ richTextNodeTypes: "strong";
13
+ constructor(name: string, component: Mark, converter: {
14
+ fromPrismic(schema: Schema): (elmt: BoldElement) => ProsemirrorMark | undefined;
15
+ toPrismic(elmt: ProsemirrorMark): undefined;
16
+ });
17
+ }
18
+ interface BoldElement {
19
+ type: "strong" | "em" | "list-item";
20
+ start: number;
21
+ end: number;
22
+ }
23
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { EmbedContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
3
- import { NodeViewProps } from "@tiptap/react";
3
+ import { type NodeViewProps } from "@tiptap/react";
4
4
  interface EmbedNode extends ProseMirrorNode {
5
5
  attrs: {
6
6
  content: EmbedContent | undefined;
@@ -1,12 +1,31 @@
1
1
  import type { EmbedContent } from "@prismicio/types-internal/lib/content";
2
- import { KeyboardEvent, RefObject } from "react";
2
+ import { type KeyboardEvent, type RefObject } from "react";
3
3
  import type { EmbedViewProps } from "./EmbedView";
4
4
  export declare function useEmbedView(props: EmbedViewProps, inputRef: RefObject<HTMLInputElement>, containerRef: RefObject<HTMLDivElement>): {
5
5
  inputRef: RefObject<HTMLInputElement>;
6
6
  containerRef: RefObject<HTMLDivElement>;
7
7
  onKeyDown: (event: KeyboardEvent<Element>) => void;
8
8
  url: string;
9
- urlChanged: (url: string) => void;
9
+ urlChanged: (newUrl: string) => void;
10
10
  onContentChange: (content?: EmbedContent) => void;
11
11
  debouncedUrl: string;
12
+ content: ({
13
+ embed_url: string;
14
+ type: string;
15
+ } & {
16
+ version?: string | number | null | undefined;
17
+ title?: string | null | undefined;
18
+ author_name?: string | null | undefined;
19
+ author_url?: string | null | undefined;
20
+ provider_name?: string | null | undefined;
21
+ provider_url?: string | null | undefined;
22
+ cache_age?: string | number | null | undefined;
23
+ thumbnail_url?: string | null | undefined;
24
+ thumbnail_width?: number | null | undefined;
25
+ thumbnail_height?: number | null | undefined;
26
+ html?: string | null | undefined;
27
+ } & {
28
+ __TYPE__: "EmbedContent";
29
+ all: unknown;
30
+ }) | undefined;
12
31
  };
@@ -1,9 +1,8 @@
1
1
  import { RichTextNodeType } from "@prismicio/types-internal/lib/customtypes";
2
2
  import { type Level as TTLevel } from "@tiptap/extension-heading";
3
- import { type ReadonlyNonEmptyArray } from "fp-ts/ReadonlyNonEmptyArray";
4
3
  import type { Node as ProsemirrorNode } from "prosemirror-model";
5
4
  import { HeadingTextExtension } from "../../models";
6
- export declare type Level = TTLevel;
5
+ export type Level = TTLevel;
7
6
  interface HeadingName {
8
7
  fullName: RichTextNodeType;
9
8
  level: Level;
@@ -11,8 +10,8 @@ interface HeadingName {
11
10
  export declare const HeadingName: {
12
11
  byLevel(level: Level): RichTextNodeType;
13
12
  default(level: Level): HeadingName;
14
- fromPrismic(headingName: string, levels?: ReadonlyNonEmptyArray<Level>): HeadingName | undefined;
15
- fromProsemirror(nodeAttributes: ProsemirrorNode["attrs"], levels: ReadonlyNonEmptyArray<Level>): HeadingName | undefined;
13
+ fromPrismic(headingName: string, levels?: Level[]): HeadingName | undefined;
14
+ fromProsemirror(nodeAttributes: ProsemirrorNode["attrs"], levels: Level[]): HeadingName | undefined;
16
15
  };
17
16
  declare const _default: {
18
17
  name: string;
@@ -1,6 +1,6 @@
1
1
  import type { ImageContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
3
- import { NodeViewProps } from "@tiptap/react";
3
+ import { type NodeViewProps } from "@tiptap/react";
4
4
  interface ImageNode extends ProseMirrorNode {
5
5
  attrs: {
6
6
  content: ImageContent | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { ImageContent } from "@prismicio/types-internal/lib/content";
2
2
  import type { CroppedImages } from "../../../ImageField/CropperDialog";
3
- import { ExternalImage } from "../../../ImageField/MediaPicker/externalImage";
3
+ import type { MediaAssetOrExternalImage } from "../../../ImageField/MediaPicker/MediaLibrary/mediaLibraryData";
4
4
  import type { ImageViewProps } from "./ImageView";
5
5
  interface useImageViewProps {
6
6
  content: ImageContent | undefined;
@@ -12,7 +12,7 @@ interface useImageViewProps {
12
12
  imageViewProps: ImageViewProps;
13
13
  }
14
14
  export declare function useImageView(props: useImageViewProps): {
15
- onMediaSelected: (media: ExternalImage) => void;
15
+ onMediaSelected: (media: MediaAssetOrExternalImage) => void;
16
16
  onCropperDialogClose: ({ croppedImages }: {
17
17
  croppedImages: CroppedImages;
18
18
  }) => void;
@@ -1,3 +1,3 @@
1
- import { MarkExtension } from "../../models/EditorExtension";
2
- declare const EditorItalic: MarkExtension<unknown>;
1
+ import { ItalicExtension } from "./ItalicModel";
2
+ declare const EditorItalic: ItalicExtension;
3
3
  export default EditorItalic;
@@ -0,0 +1,23 @@
1
+ import type { Mark } from "@tiptap/core";
2
+ import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
3
+ import { ExtensionType } from "../../models";
4
+ export declare class ItalicExtension {
5
+ readonly name: string;
6
+ readonly component: Mark;
7
+ readonly converter: {
8
+ fromPrismic(schema: Schema): (elmt: ItalicElement) => ProsemirrorMark | undefined;
9
+ toPrismic(elmt: ProsemirrorMark): undefined;
10
+ };
11
+ extType: ExtensionType.Mark;
12
+ richTextNodeTypes: "em";
13
+ constructor(name: string, component: Mark, converter: {
14
+ fromPrismic(schema: Schema): (elmt: ItalicElement) => ProsemirrorMark | undefined;
15
+ toPrismic(elmt: ProsemirrorMark): undefined;
16
+ });
17
+ }
18
+ interface ItalicElement {
19
+ type: "strong" | "em" | "list-item";
20
+ start: number;
21
+ end: number;
22
+ }
23
+ export {};
@@ -0,0 +1,35 @@
1
+ import type { MediaAssetOrExternalImage } from "../../../ImageField/MediaPicker/MediaLibrary/mediaLibraryData";
2
+ import { type FileLinkData, type ImageLinkData, type LinkElementData, LinkExtension } from "./LinkModel";
3
+ export interface LinkProtocolOptions {
4
+ scheme: string;
5
+ optionalSlashes?: boolean;
6
+ }
7
+ export interface LinkOptions {
8
+ autolink: boolean;
9
+ protocols: (LinkProtocolOptions | string)[];
10
+ openOnClick: boolean;
11
+ linkOnPaste: boolean;
12
+ /** These are the values passed into the HTML through the Tiptap extension. */
13
+ htmlAttributes: Record<string, any>;
14
+ validate?: (url: string) => boolean;
15
+ }
16
+ declare module "@tiptap/core" {
17
+ interface Commands<ReturnType> {
18
+ Link: {
19
+ setWebLink: (attributes: {
20
+ href: string;
21
+ target?: string | null;
22
+ }) => ReturnType;
23
+ setDocumentLink: (attributes: {
24
+ id: string;
25
+ }) => ReturnType;
26
+ setMediaLink: (attributes: {
27
+ media: MediaAssetOrExternalImage;
28
+ }) => ReturnType;
29
+ unsetLink: () => ReturnType;
30
+ };
31
+ }
32
+ }
33
+ export declare const Link: LinkExtension;
34
+ export declare function stringifyMediaLinkData(media: ImageLinkData | FileLinkData): string;
35
+ export declare function parseMediaLinkData(media: string): LinkElementData;
@@ -0,0 +1,58 @@
1
+ import type { Mark } from "@tiptap/core";
2
+ import type { Mark as ProsemirrorMark, Schema } from "prosemirror-model";
3
+ import { ExtensionType } from "../../models";
4
+ export declare class LinkExtension {
5
+ readonly name: string;
6
+ readonly component: Mark;
7
+ readonly converter: {
8
+ fromPrismic(schema: Schema): (elmt: LinkElement) => ProsemirrorMark | undefined;
9
+ toPrismic(elmt: ProsemirrorMark): LinkElementData;
10
+ };
11
+ extType: ExtensionType.Mark;
12
+ richTextNodeTypes: "hyperlink";
13
+ constructor(name: string, component: Mark, converter: {
14
+ fromPrismic(schema: Schema): (elmt: LinkElement) => ProsemirrorMark | undefined;
15
+ toPrismic(elmt: ProsemirrorMark): LinkElementData;
16
+ });
17
+ }
18
+ export interface LinkElement {
19
+ type: "hyperlink";
20
+ start: number;
21
+ end: number;
22
+ data: LinkElementData;
23
+ }
24
+ export type LinkElementData = ImageLinkData | FileLinkData | DocumentLinkData | ExternalLinkData;
25
+ export interface ImageLinkData {
26
+ __TYPE__: "ImageLink";
27
+ id: string;
28
+ url: string;
29
+ height: string;
30
+ width: string;
31
+ size: string;
32
+ name: string;
33
+ kind: string;
34
+ date?: string | null | undefined;
35
+ }
36
+ export interface FileLinkData {
37
+ __TYPE__: "FileLink";
38
+ id: string;
39
+ url: string;
40
+ name: string;
41
+ kind: string;
42
+ size: string;
43
+ date?: string | null | undefined;
44
+ }
45
+ interface DocumentLinkData {
46
+ __TYPE__: "DocumentLink";
47
+ id: string;
48
+ }
49
+ interface ExternalLinkData {
50
+ __TYPE__: "ExternalLink";
51
+ url: string;
52
+ kind?: "web";
53
+ target?: string | null | undefined;
54
+ preview?: {
55
+ title?: string;
56
+ } | null | undefined;
57
+ }
58
+ export {};
@@ -7,10 +7,10 @@ import { default as Embed } from "./Embed/EmbedExtension";
7
7
  import { default as Heading } from "./Heading/Heading";
8
8
  import { default as Image } from "./Image/ImageExtension";
9
9
  import { default as Italic } from "./Italic/Italic";
10
- import { Link } from "./Link";
10
+ import { Link } from "./Link/Link";
11
11
  import { default as OrderedList } from "./OrderedList/OrderedList";
12
12
  import { default as Paragraph } from "./Paragraph/Paragraph";
13
13
  export declare const DefaultTextExtension: import("../models").TextExtension;
14
- export declare const MarkExtensions: import("../models").MarkExtension<unknown>[];
14
+ export declare const MarkExtensions: (import("./Bold/BoldModel").BoldExtension | import("./Italic/ItalicModel").ItalicExtension | import("./Link/LinkModel").LinkExtension)[];
15
15
  export declare function getAllExtensions(nodeTypes?: Set<RichTextNodeType>): WidgetExtension[];
16
16
  export { Bold, BulletList, CodeBlock, Embed, Heading, Image, Italic, Link, OrderedList, Paragraph };