@payloadcms/richtext-slate 1.0.0-beta.1 → 1.0.0-beta.3
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/cell/index.d.ts +6 -0
- package/dist/data/defaultValue.d.ts +6 -0
- package/dist/data/populate.d.ts +20 -0
- package/dist/data/recurseNestedFields.d.ts +14 -0
- package/dist/data/richTextRelationshipPromise.d.ts +17 -0
- package/dist/data/validation.d.ts +4 -0
- package/dist/field/RichText.d.ts +16 -0
- package/dist/field/elements/Button.d.ts +7 -0
- package/dist/field/elements/EnabledRelationshipsCondition.d.ts +3 -0
- package/dist/field/elements/ListButton.d.ts +7 -0
- package/dist/field/elements/areAllChildrenElements.d.ts +3 -0
- package/dist/field/elements/blockquote/index.d.ts +11 -0
- package/dist/field/elements/getCommonBlock.d.ts +4 -0
- package/dist/field/elements/h1/index.d.ts +10 -0
- package/dist/field/elements/h2/index.d.ts +10 -0
- package/dist/field/elements/h3/index.d.ts +10 -0
- package/dist/field/elements/h4/index.d.ts +10 -0
- package/dist/field/elements/h5/index.d.ts +10 -0
- package/dist/field/elements/h6/index.d.ts +10 -0
- package/dist/field/elements/indent/index.d.ts +10 -0
- package/dist/field/elements/index.d.ts +117 -0
- package/dist/field/elements/injectVoid.d.ts +4 -0
- package/dist/field/elements/isActive.d.ts +4 -0
- package/dist/field/elements/isBlockElement.d.ts +9 -0
- package/dist/field/elements/isLastSelectedElementEmpty.d.ts +3 -0
- package/dist/field/elements/isListActive.d.ts +4 -0
- package/dist/field/elements/isWithinListItem.d.ts +3 -0
- package/dist/field/elements/li/index.d.ts +6 -0
- package/dist/field/elements/link/Button/index.d.ts +7 -0
- package/dist/field/elements/link/Element/index.d.ts +12 -0
- package/dist/field/elements/link/LinkDrawer/baseFields.d.ts +4 -0
- package/dist/field/elements/link/LinkDrawer/index.d.ts +5 -0
- package/dist/field/elements/link/LinkDrawer/types.d.ts +9 -0
- package/dist/field/elements/link/index.d.ts +17 -0
- package/dist/field/elements/link/shared.d.ts +2 -0
- package/dist/field/elements/link/utilities.d.ts +16 -0
- package/dist/field/elements/listTypes.d.ts +3 -0
- package/dist/field/elements/ol/index.d.ts +11 -0
- package/dist/field/elements/relationship/Button/Fields/index.d.ts +4 -0
- package/dist/field/elements/relationship/Button/index.d.ts +9 -0
- package/dist/field/elements/relationship/Element/index.d.ts +13 -0
- package/dist/field/elements/relationship/index.d.ts +16 -0
- package/dist/field/elements/relationship/plugin.d.ts +3 -0
- package/dist/field/elements/textAlign/index.d.ts +7 -0
- package/dist/field/elements/toggle.d.ts +4 -0
- package/dist/field/elements/toggleList.d.ts +4 -0
- package/dist/field/elements/types.d.ts +11 -0
- package/dist/field/elements/ul/index.d.ts +11 -0
- package/dist/field/elements/unwrapList.d.ts +4 -0
- package/dist/field/elements/upload/Button/index.d.ts +9 -0
- package/dist/field/elements/upload/Element/UploadDrawer/index.d.ts +8 -0
- package/dist/field/elements/upload/Element/index.d.ts +14 -0
- package/dist/field/elements/upload/index.d.ts +11 -0
- package/dist/field/elements/upload/plugin.d.ts +3 -0
- package/dist/field/enablePlugins.d.ts +3 -0
- package/dist/field/hotkeys.d.ts +8 -0
- package/dist/field/icons/AlignCenter/index.d.ts +4 -0
- package/dist/field/icons/AlignLeft/index.d.ts +4 -0
- package/dist/field/icons/AlignRight/index.d.ts +4 -0
- package/dist/field/icons/Blockquote/index.d.ts +4 -0
- package/dist/field/icons/Bold/index.d.ts +4 -0
- package/dist/field/icons/Code/index.d.ts +4 -0
- package/dist/field/icons/IndentLeft/index.d.ts +5 -0
- package/dist/field/icons/IndentRight/index.d.ts +5 -0
- package/dist/field/icons/Italic/index.d.ts +4 -0
- package/dist/field/icons/Link/index.d.ts +5 -0
- package/dist/field/icons/OrderedList/index.d.ts +4 -0
- package/dist/field/icons/Relationship/index.d.ts +5 -0
- package/dist/field/icons/Strikethrough/index.d.ts +4 -0
- package/dist/field/icons/Underline/index.d.ts +4 -0
- package/dist/field/icons/UnorderedList/index.d.ts +4 -0
- package/dist/field/icons/Upload/index.d.ts +5 -0
- package/dist/field/icons/headings/H1/index.d.ts +4 -0
- package/dist/field/icons/headings/H2/index.d.ts +4 -0
- package/dist/field/icons/headings/H3/index.d.ts +4 -0
- package/dist/field/icons/headings/H4/index.d.ts +4 -0
- package/dist/field/icons/headings/H5/index.d.ts +4 -0
- package/dist/field/icons/headings/H6/index.d.ts +4 -0
- package/dist/field/icons/headings/index.d.ts +11 -0
- package/dist/field/index.d.ts +5 -0
- package/dist/field/leaves/Button.d.ts +8 -0
- package/dist/field/leaves/bold/index.d.ts +10 -0
- package/dist/field/leaves/code/index.d.ts +10 -0
- package/dist/field/leaves/index.d.ts +40 -0
- package/dist/field/leaves/isActive.d.ts +3 -0
- package/dist/field/leaves/italic/index.d.ts +10 -0
- package/dist/field/leaves/strikethrough/index.d.ts +10 -0
- package/dist/field/leaves/toggle.d.ts +3 -0
- package/dist/field/leaves/underline/index.d.ts +10 -0
- package/dist/field/mergeCustomFunctions.d.ts +3 -0
- package/dist/field/plugins/withEnterBreakOut.d.ts +3 -0
- package/dist/field/plugins/withHTML.d.ts +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -4
- package/dist/types.d.ts +55 -0
- package/package.json +3 -2
- package/src/index.ts +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CellComponentProps, RichTextField } from 'payload/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { AdapterArguments } from '../types';
|
|
4
|
+
declare const RichTextCell: React.FC<CellComponentProps<RichTextField<AdapterArguments>, any>>;
|
|
5
|
+
export default RichTextCell;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload/types';
|
|
2
|
+
import type { Collection, Field, RichTextField } from 'payload/types';
|
|
3
|
+
import type { AdapterArguments } from '../types';
|
|
4
|
+
type Arguments = {
|
|
5
|
+
currentDepth?: number;
|
|
6
|
+
data: unknown;
|
|
7
|
+
depth: number;
|
|
8
|
+
field: RichTextField<AdapterArguments>;
|
|
9
|
+
key: number | string;
|
|
10
|
+
overrideAccess?: boolean;
|
|
11
|
+
req: PayloadRequest;
|
|
12
|
+
showHiddenFields: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const populate: ({ id, collection, currentDepth, data, depth, key, overrideAccess, req, showHiddenFields, }: Omit<Arguments, "field"> & {
|
|
15
|
+
collection: Collection;
|
|
16
|
+
field: Field;
|
|
17
|
+
id: string;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=populate.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Field, PayloadRequest } from 'payload/types';
|
|
2
|
+
type NestedRichTextFieldsArgs = {
|
|
3
|
+
currentDepth?: number;
|
|
4
|
+
data: unknown;
|
|
5
|
+
depth: number;
|
|
6
|
+
fields: Field[];
|
|
7
|
+
overrideAccess: boolean;
|
|
8
|
+
promises: Promise<void>[];
|
|
9
|
+
req: PayloadRequest;
|
|
10
|
+
showHiddenFields: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const recurseNestedFields: ({ currentDepth, data, depth, fields, overrideAccess, promises, req, showHiddenFields, }: NestedRichTextFieldsArgs) => void;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=recurseNestedFields.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PayloadRequest, RichTextAdapter, RichTextField } from 'payload/types';
|
|
2
|
+
import type { AdapterArguments } from '../types';
|
|
3
|
+
export type Args = Parameters<RichTextAdapter<AdapterArguments>['afterReadPromise']>[0];
|
|
4
|
+
type RecurseRichTextArgs = {
|
|
5
|
+
children: unknown[];
|
|
6
|
+
currentDepth: number;
|
|
7
|
+
depth: number;
|
|
8
|
+
field: RichTextField<AdapterArguments>;
|
|
9
|
+
overrideAccess: boolean;
|
|
10
|
+
promises: Promise<void>[];
|
|
11
|
+
req: PayloadRequest;
|
|
12
|
+
showHiddenFields: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const recurseRichText: ({ children, currentDepth, depth, field, overrideAccess, promises, req, showHiddenFields, }: RecurseRichTextArgs) => void;
|
|
15
|
+
export declare const richTextRelationshipPromise: ({ currentDepth, depth, field, overrideAccess, req, showHiddenFields, siblingDoc, }: Args) => Promise<void>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=richTextRelationshipPromise.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseEditor } from 'slate';
|
|
2
|
+
import type { HistoryEditor } from 'slate-history';
|
|
3
|
+
import type { ReactEditor } from 'slate-react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { ElementNode, FieldProps, TextNode } from '../types';
|
|
6
|
+
import './index.scss';
|
|
7
|
+
declare module 'slate' {
|
|
8
|
+
interface CustomTypes {
|
|
9
|
+
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
10
|
+
Element: ElementNode;
|
|
11
|
+
Text: TextNode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.FC<FieldProps>;
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=RichText.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonProps } from './types';
|
|
3
|
+
import '../buttons.scss';
|
|
4
|
+
export declare const baseClass = "rich-text__button";
|
|
5
|
+
declare const ElementButton: React.FC<ButtonProps>;
|
|
6
|
+
export default ElementButton;
|
|
7
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonProps } from './types';
|
|
3
|
+
import '../buttons.scss';
|
|
4
|
+
export declare const baseClass = "rich-text__button";
|
|
5
|
+
declare const ListButton: React.FC<ButtonProps>;
|
|
6
|
+
export default ListButton;
|
|
7
|
+
//# sourceMappingURL=ListButton.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
declare const blockquote: {
|
|
4
|
+
Button: () => React.JSX.Element;
|
|
5
|
+
Element: ({ attributes, children }: {
|
|
6
|
+
attributes: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export default blockquote;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const elements: {
|
|
3
|
+
blockquote: {
|
|
4
|
+
Button: () => import("react").JSX.Element;
|
|
5
|
+
Element: ({ attributes, children }: {
|
|
6
|
+
attributes: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
h1: {
|
|
11
|
+
Button: () => import("react").JSX.Element;
|
|
12
|
+
Element: ({ attributes, children }: {
|
|
13
|
+
attributes: any;
|
|
14
|
+
children: any;
|
|
15
|
+
}) => import("react").JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
h2: {
|
|
18
|
+
Button: () => import("react").JSX.Element;
|
|
19
|
+
Element: ({ attributes, children }: {
|
|
20
|
+
attributes: any;
|
|
21
|
+
children: any;
|
|
22
|
+
}) => import("react").JSX.Element;
|
|
23
|
+
};
|
|
24
|
+
h3: {
|
|
25
|
+
Button: () => import("react").JSX.Element;
|
|
26
|
+
Element: ({ attributes, children }: {
|
|
27
|
+
attributes: any;
|
|
28
|
+
children: any;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
h4: {
|
|
32
|
+
Button: () => import("react").JSX.Element;
|
|
33
|
+
Element: ({ attributes, children }: {
|
|
34
|
+
attributes: any;
|
|
35
|
+
children: any;
|
|
36
|
+
}) => import("react").JSX.Element;
|
|
37
|
+
};
|
|
38
|
+
h5: {
|
|
39
|
+
Button: () => import("react").JSX.Element;
|
|
40
|
+
Element: ({ attributes, children }: {
|
|
41
|
+
attributes: any;
|
|
42
|
+
children: any;
|
|
43
|
+
}) => import("react").JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
h6: {
|
|
46
|
+
Button: () => import("react").JSX.Element;
|
|
47
|
+
Element: ({ attributes, children }: {
|
|
48
|
+
attributes: any;
|
|
49
|
+
children: any;
|
|
50
|
+
}) => import("react").JSX.Element;
|
|
51
|
+
};
|
|
52
|
+
indent: {
|
|
53
|
+
Button: () => import("react").JSX.Element;
|
|
54
|
+
Element: ({ attributes, children }: {
|
|
55
|
+
attributes: any;
|
|
56
|
+
children: any;
|
|
57
|
+
}) => import("react").JSX.Element;
|
|
58
|
+
};
|
|
59
|
+
li: {
|
|
60
|
+
Element: (props: any) => import("react").JSX.Element;
|
|
61
|
+
};
|
|
62
|
+
link: {
|
|
63
|
+
Button: import("react").FC<{
|
|
64
|
+
fieldProps: import("../../types").FieldProps;
|
|
65
|
+
path: string;
|
|
66
|
+
}>;
|
|
67
|
+
Element: import("react").FC<{
|
|
68
|
+
attributes: import("react").HTMLAttributes<HTMLDivElement>;
|
|
69
|
+
children: import("react").ReactNode;
|
|
70
|
+
editorRef: import("react").RefObject<HTMLDivElement>;
|
|
71
|
+
element: any;
|
|
72
|
+
fieldProps: import("../../types").FieldProps;
|
|
73
|
+
}>;
|
|
74
|
+
plugins: ((incomingEditor: import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor) => import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor)[];
|
|
75
|
+
};
|
|
76
|
+
ol: {
|
|
77
|
+
Button: () => import("react").JSX.Element;
|
|
78
|
+
Element: ({ attributes, children }: {
|
|
79
|
+
attributes: any;
|
|
80
|
+
children: any;
|
|
81
|
+
}) => import("react").JSX.Element;
|
|
82
|
+
};
|
|
83
|
+
relationship: {
|
|
84
|
+
Button: (props: {
|
|
85
|
+
enabledCollectionSlugs: string[];
|
|
86
|
+
path: string;
|
|
87
|
+
}) => import("react").ReactNode;
|
|
88
|
+
Element: (props: {
|
|
89
|
+
attributes: import("react").HTMLAttributes<HTMLDivElement>;
|
|
90
|
+
children: import("react").ReactNode;
|
|
91
|
+
element: any;
|
|
92
|
+
fieldProps: import("../../types").FieldProps;
|
|
93
|
+
}) => import("react").ReactNode;
|
|
94
|
+
plugins: ((incomingEditor: any) => any)[];
|
|
95
|
+
};
|
|
96
|
+
textAlign: {
|
|
97
|
+
name: string;
|
|
98
|
+
Button: () => import("react").JSX.Element;
|
|
99
|
+
};
|
|
100
|
+
ul: {
|
|
101
|
+
Button: () => import("react").JSX.Element;
|
|
102
|
+
Element: ({ attributes, children }: {
|
|
103
|
+
attributes: any;
|
|
104
|
+
children: any;
|
|
105
|
+
}) => import("react").JSX.Element;
|
|
106
|
+
};
|
|
107
|
+
upload: {
|
|
108
|
+
Button: (props: {
|
|
109
|
+
enabledCollectionSlugs: string[];
|
|
110
|
+
path: string;
|
|
111
|
+
}) => import("react").ReactNode;
|
|
112
|
+
Element: (props: import("./upload/Element").ElementProps) => import("react").ReactNode;
|
|
113
|
+
plugins: ((incomingEditor: any) => any)[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export default elements;
|
|
117
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from 'slate';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true, if the provided node is a Block Element.
|
|
4
|
+
* Note: Using Editor.isBlock() is not sufficient, as since slate 0.90 it returns `true` for Text nodes and the editor as well.
|
|
5
|
+
*
|
|
6
|
+
* Related Issue: https://github.com/ianstormtaylor/slate/issues/5287
|
|
7
|
+
*/
|
|
8
|
+
export declare const isBlockElement: (editor: Editor, node: any) => node is import("../../types").ElementNode;
|
|
9
|
+
//# sourceMappingURL=isBlockElement.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FieldProps } from '../../../../types';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
export declare const LinkElement: React.FC<{
|
|
6
|
+
attributes: HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
editorRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
element: any;
|
|
10
|
+
fieldProps: FieldProps;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Field, Fields } from 'payload/types';
|
|
2
|
+
export type Props = {
|
|
3
|
+
drawerSlug: string;
|
|
4
|
+
fieldSchema: Field[];
|
|
5
|
+
handleClose: () => void;
|
|
6
|
+
handleModalSubmit: (fields: Fields, data: Record<string, unknown>) => void;
|
|
7
|
+
initialState?: Fields;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const link: {
|
|
3
|
+
Button: import("react").FC<{
|
|
4
|
+
fieldProps: import("../../../types").FieldProps;
|
|
5
|
+
path: string;
|
|
6
|
+
}>;
|
|
7
|
+
Element: import("react").FC<{
|
|
8
|
+
attributes: import("react").HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
children: import("react").ReactNode;
|
|
10
|
+
editorRef: import("react").RefObject<HTMLDivElement>;
|
|
11
|
+
element: any;
|
|
12
|
+
fieldProps: import("../../../types").FieldProps;
|
|
13
|
+
}>;
|
|
14
|
+
plugins: ((incomingEditor: import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor) => import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor)[];
|
|
15
|
+
};
|
|
16
|
+
export default link;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { i18n } from 'i18next';
|
|
2
|
+
import type { SanitizedConfig } from 'payload/config';
|
|
3
|
+
import type { Field } from 'payload/types';
|
|
4
|
+
import type { Editor } from 'slate';
|
|
5
|
+
export declare const unwrapLink: (editor: Editor) => void;
|
|
6
|
+
export declare const wrapLink: (editor: Editor) => void;
|
|
7
|
+
export declare const withLinks: (incomingEditor: Editor) => Editor;
|
|
8
|
+
/**
|
|
9
|
+
* This function is run to enrich the basefields which every link has with potential, custom user-added fields.
|
|
10
|
+
*/
|
|
11
|
+
export declare function transformExtraFields(customFieldSchema: ((args: {
|
|
12
|
+
config: SanitizedConfig;
|
|
13
|
+
defaultFields: Field[];
|
|
14
|
+
i18n: i18n;
|
|
15
|
+
}) => Field[]) | Field[], config: SanitizedConfig, i18n: i18n): Field[];
|
|
16
|
+
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
declare const ol: {
|
|
4
|
+
Button: () => React.JSX.Element;
|
|
5
|
+
Element: ({ attributes, children }: {
|
|
6
|
+
attributes: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export default ol;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FieldProps } from '../../../../types';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
type Props = {
|
|
6
|
+
attributes: HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
element: any;
|
|
9
|
+
fieldProps: FieldProps;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: (props: Props) => React.ReactNode;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
Button: (props: {
|
|
4
|
+
enabledCollectionSlugs: string[];
|
|
5
|
+
path: string;
|
|
6
|
+
}) => import("react").ReactNode;
|
|
7
|
+
Element: (props: {
|
|
8
|
+
attributes: import("react").HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
children: import("react").ReactNode;
|
|
10
|
+
element: any;
|
|
11
|
+
fieldProps: import("../../../types").FieldProps;
|
|
12
|
+
}) => import("react").ReactNode;
|
|
13
|
+
plugins: ((incomingEditor: any) => any)[];
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
export type ButtonProps = {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
el?: ElementType;
|
|
6
|
+
format: string;
|
|
7
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
declare const ul: {
|
|
4
|
+
Button: () => React.JSX.Element;
|
|
5
|
+
Element: ({ attributes, children }: {
|
|
6
|
+
attributes: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export default ul;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SanitizedCollectionConfig } from 'payload/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ElementProps } from '..';
|
|
4
|
+
export declare const UploadDrawer: React.FC<ElementProps & {
|
|
5
|
+
drawerSlug: string;
|
|
6
|
+
relatedCollection: SanitizedCollectionConfig;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FieldProps } from '../../../../types';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
export type ElementProps = {
|
|
6
|
+
attributes: HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
element: any;
|
|
9
|
+
enabledCollectionSlugs: string[];
|
|
10
|
+
fieldProps: FieldProps;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: (props: ElementProps) => React.ReactNode;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
Button: (props: {
|
|
4
|
+
enabledCollectionSlugs: string[];
|
|
5
|
+
path: string;
|
|
6
|
+
}) => import("react").ReactNode;
|
|
7
|
+
Element: (props: import("./Element").ElementProps) => import("react").ReactNode;
|
|
8
|
+
plugins: ((incomingEditor: any) => any)[];
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
H1: import("react").FC<{}>;
|
|
4
|
+
H2: import("react").FC<{}>;
|
|
5
|
+
H3: import("react").FC<{}>;
|
|
6
|
+
H4: import("react").FC<{}>;
|
|
7
|
+
H5: import("react").FC<{}>;
|
|
8
|
+
H6: import("react").FC<{}>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
bold: {
|
|
4
|
+
Button: () => import("react").JSX.Element;
|
|
5
|
+
Leaf: ({ attributes, children }: {
|
|
6
|
+
attributes: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
code: {
|
|
11
|
+
Button: () => import("react").JSX.Element;
|
|
12
|
+
Leaf: ({ attributes, children }: {
|
|
13
|
+
attributes: any;
|
|
14
|
+
children: any;
|
|
15
|
+
}) => import("react").JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
italic: {
|
|
18
|
+
Button: () => import("react").JSX.Element;
|
|
19
|
+
Leaf: ({ attributes, children }: {
|
|
20
|
+
attributes: any;
|
|
21
|
+
children: any;
|
|
22
|
+
}) => import("react").JSX.Element;
|
|
23
|
+
};
|
|
24
|
+
strikethrough: {
|
|
25
|
+
Button: () => import("react").JSX.Element;
|
|
26
|
+
Leaf: ({ attributes, children }: {
|
|
27
|
+
attributes: any;
|
|
28
|
+
children: any;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
underline: {
|
|
32
|
+
Button: () => import("react").JSX.Element;
|
|
33
|
+
Leaf: ({ attributes, children }: {
|
|
34
|
+
attributes: any;
|
|
35
|
+
children: any;
|
|
36
|
+
}) => import("react").JSX.Element;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const strikethrough: {
|
|
3
|
+
Button: () => React.JSX.Element;
|
|
4
|
+
Leaf: ({ attributes, children }: {
|
|
5
|
+
attributes: any;
|
|
6
|
+
children: any;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export default strikethrough;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const underline: {
|
|
3
|
+
Button: () => React.JSX.Element;
|
|
4
|
+
Leaf: ({ attributes, children }: {
|
|
5
|
+
attributes: any;
|
|
6
|
+
children: any;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export default underline;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "slateEditor", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
|
-
return
|
|
8
|
+
return slateEditor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _utilities = require("payload/components/utilities");
|
|
@@ -17,7 +17,7 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
default: obj
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function slateEditor(args) {
|
|
21
21
|
return {
|
|
22
22
|
CellComponent: (0, _utilities.withMergedProps)({
|
|
23
23
|
Component: _cell.default,
|
|
@@ -44,4 +44,4 @@ function createSlate(args) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFJpY2hUZXh0QWRhcHRlciB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHdpdGhNZXJnZWRQcm9wcyB9IGZyb20gJ3BheWxvYWQvY29tcG9uZW50cy91dGlsaXRpZXMnXG5cbmltcG9ydCB0eXBlIHsgQWRhcHRlckFyZ3VtZW50cyB9IGZyb20gJy4vd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BQUM7WUFDOUJDLFdBQVdJLGNBQWE7WUFDeEJGLGtCQUFrQkw7UUFDcEI7UUFDQVEsa0JBQWlCLEVBQ2ZDLFlBQVksRUFDWkMsS0FBSyxFQUNMQyxLQUFLLEVBQ0xDLGNBQWMsRUFDZEMsR0FBRyxFQUNIQyxnQkFBZ0IsRUFDaEJDLFVBQVUsRUFDWDtZQUNDLElBQ0VKLE1BQU1LLEtBQUssRUFBRUMsVUFBVUMsU0FBUyxtQkFDaENQLE1BQU1LLEtBQUssRUFBRUMsVUFBVUMsU0FBUyxhQUNoQ1AsTUFBTUssS0FBSyxFQUFFQyxVQUFVQyxTQUFTLFdBQ2hDLENBQUNQLE9BQU9LLE9BQU9DLFVBQ2Y7Z0JBQ0EsT0FBT0UsSUFBQUEsd0RBQTJCLEVBQUM7b0JBQ2pDVjtvQkFDQUM7b0JBQ0FDO29CQUNBQztvQkFDQUM7b0JBQ0FDO29CQUNBQztnQkFDRjtZQUNGO1lBQ0EsT0FBTztRQUNUO0lBQ0Y7QUFDRiJ9
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { i18n as Ii18n } from 'i18next';
|
|
3
|
+
import type { SanitizedConfig } from 'payload/config';
|
|
4
|
+
import type { Field, RichTextFieldProps } from 'payload/types';
|
|
5
|
+
import type { Editor } from 'slate';
|
|
6
|
+
export type TextNode = {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
export type ElementNode = {
|
|
11
|
+
children: (ElementNode | TextNode)[];
|
|
12
|
+
type?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode;
|
|
15
|
+
type RichTextPlugin = (editor: Editor) => Editor;
|
|
16
|
+
export type RichTextCustomElement = {
|
|
17
|
+
Button: React.ComponentType<any>;
|
|
18
|
+
Element: React.ComponentType<any>;
|
|
19
|
+
name: string;
|
|
20
|
+
plugins?: RichTextPlugin[];
|
|
21
|
+
};
|
|
22
|
+
export type RichTextCustomLeaf = {
|
|
23
|
+
Button: React.ComponentType<any>;
|
|
24
|
+
Leaf: React.ComponentType<any>;
|
|
25
|
+
name: string;
|
|
26
|
+
plugins?: RichTextPlugin[];
|
|
27
|
+
};
|
|
28
|
+
export type RichTextElement = 'blockquote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'indent' | 'link' | 'ol' | 'relationship' | 'textAlign' | 'ul' | 'upload' | RichTextCustomElement;
|
|
29
|
+
export type RichTextLeaf = 'bold' | 'code' | 'italic' | 'strikethrough' | 'underline' | RichTextCustomLeaf;
|
|
30
|
+
export type AdapterArguments = {
|
|
31
|
+
admin?: {
|
|
32
|
+
elements?: RichTextElement[];
|
|
33
|
+
hideGutter?: boolean;
|
|
34
|
+
leaves?: RichTextLeaf[];
|
|
35
|
+
link?: {
|
|
36
|
+
fields?: ((args: {
|
|
37
|
+
config: SanitizedConfig;
|
|
38
|
+
defaultFields: Field[];
|
|
39
|
+
i18n: Ii18n;
|
|
40
|
+
}) => Field[]) | Field[];
|
|
41
|
+
};
|
|
42
|
+
placeholder?: Record<string, string> | string;
|
|
43
|
+
rtl?: boolean;
|
|
44
|
+
upload?: {
|
|
45
|
+
collections: {
|
|
46
|
+
[collection: string]: {
|
|
47
|
+
fields: Field[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type FieldProps = RichTextFieldProps<AdapterArguments>;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-slate",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "The officially supported Slate richtext adapter for Payload",
|
|
5
5
|
"repository": "https://github.com/payloadcms/payload",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/node": "20.5.7",
|
|
24
24
|
"@types/react": "18.2.15",
|
|
25
25
|
"@payloadcms/eslint-config": "0.0.1",
|
|
26
|
-
"payload": "2.0.0-beta.
|
|
26
|
+
"payload": "2.0.0-beta.15"
|
|
27
27
|
},
|
|
28
28
|
"exports": null,
|
|
29
29
|
"publishConfig": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
|
|
37
37
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
38
38
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
39
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
39
40
|
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
|
|
40
41
|
}
|
|
41
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import RichTextCell from './cell'
|
|
|
8
8
|
import { richTextRelationshipPromise } from './data/richTextRelationshipPromise'
|
|
9
9
|
import RichTextField from './field'
|
|
10
10
|
|
|
11
|
-
export function
|
|
11
|
+
export function slateEditor(args: AdapterArguments): RichTextAdapter<AdapterArguments> {
|
|
12
12
|
return {
|
|
13
13
|
CellComponent: withMergedProps({
|
|
14
14
|
Component: RichTextCell,
|