@payloadcms/richtext-slate 3.0.0-beta.9 → 3.0.0-canary.f6e77b8
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/data/populate.d.ts +4 -3
- package/dist/data/populate.d.ts.map +1 -1
- package/dist/data/populate.js +13 -11
- package/dist/data/populate.js.map +1 -1
- package/dist/data/recurseNestedFields.d.ts +5 -4
- package/dist/data/recurseNestedFields.d.ts.map +1 -1
- package/dist/data/recurseNestedFields.js +21 -11
- package/dist/data/recurseNestedFields.js.map +1 -1
- package/dist/data/richTextRelationshipPromise.d.ts +7 -6
- package/dist/data/richTextRelationshipPromise.d.ts.map +1 -1
- package/dist/data/richTextRelationshipPromise.js +14 -10
- package/dist/data/richTextRelationshipPromise.js.map +1 -1
- package/dist/data/validation.js +3 -3
- package/dist/data/validation.js.map +1 -1
- package/dist/field/RichText.d.ts +0 -2
- package/dist/field/RichText.d.ts.map +1 -1
- package/dist/field/RichText.js +5 -1
- package/dist/field/RichText.js.map +1 -1
- package/dist/field/elements/link/LinkDrawer/baseFields.d.ts +2 -2
- package/dist/field/elements/link/LinkDrawer/baseFields.d.ts.map +1 -1
- package/dist/field/elements/link/LinkDrawer/baseFields.js.map +1 -1
- package/dist/field/elements/link/utilities.d.ts +1 -3
- package/dist/field/elements/link/utilities.d.ts.map +1 -1
- package/dist/field/elements/link/utilities.js +3 -4
- package/dist/field/elements/link/utilities.js.map +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +2 -15
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js +3 -16
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -30
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +23 -17
- package/src/index.tsx +0 -82
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEnC,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7D,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,CAAC,WAAW,GAAG,QAAQ,CAAC,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,IAAI,QAAQ,CAE7E;AAED,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,aAAa,CAAA;AACzD,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAA;AAEvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,uBAAuB,EAAE,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC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AAC,CAAA"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload/config'\nimport type { Field, RichTextFieldProps } from 'payload/types'\nimport type { Editor } from 'slate'\n\nexport type TextNode = { [x: string]: unknown; text: string }\n\nexport type ElementNode = { children: (ElementNode | TextNode)[]; type?: string }\n\nexport function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode {\n return 'text' in node\n}\n\nexport type RichTextPluginComponent = React.ComponentType\nexport type RichTextPlugin = (editor: Editor) => Editor\n\nexport type RichTextCustomElement = {\n Button?: React.ComponentType<any>\n Element: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextCustomLeaf = {\n Button: React.ComponentType<any>\n Leaf: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextElement =\n | 'blockquote'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'indent'\n | 'link'\n | 'ol'\n | 'relationship'\n | 'textAlign'\n | 'ul'\n | 'upload'\n | RichTextCustomElement\nexport type RichTextLeaf =\n | 'bold'\n | 'code'\n | 'italic'\n | 'strikethrough'\n | 'underline'\n | RichTextCustomLeaf\n\nexport type AdapterArguments = {\n admin?: {\n elements?: RichTextElement[]\n hideGutter?: boolean\n leaves?: RichTextLeaf[]\n link?: {\n fields?: ((args: { config: SanitizedConfig; defaultFields: Field[] }) => Field[]) | Field[]\n }\n placeholder?: Record<string, string> | string\n rtl?: boolean\n upload?: {\n collections: {\n [collection: string]: {\n fields: Field[]\n }\n }\n }\n }\n}\n\nexport type FieldProps = RichTextFieldProps<any[], AdapterArguments, AdapterArguments>\n"],"names":["nodeIsTextNode","node"],"rangeMappings":";;","mappings":"AAQA,OAAO,SAASA,eAAeC,IAA4B;IACzD,OAAO,UAAUA;AACnB"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-slate",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-canary.f6e77b8",
|
|
4
4
|
"description": "The officially supported Slate richtext adapter for Payload",
|
|
5
|
+
"homepage": "https://payloadcms.com",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/payloadcms/payload.git",
|
|
8
9
|
"directory": "packages/richtext-slate"
|
|
9
10
|
},
|
|
10
11
|
"license": "MIT",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
12
|
+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
13
21
|
"main": "./dist/index.js",
|
|
14
22
|
"types": "./dist/index.d.ts",
|
|
15
|
-
"
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
16
26
|
"dependencies": {
|
|
17
27
|
"@faceless-ui/modal": "2.0.2",
|
|
18
28
|
"is-hotkey": "0.2.0",
|
|
19
|
-
"react": "18.2.0",
|
|
20
29
|
"slate": "0.91.4",
|
|
21
30
|
"slate-history": "0.86.0",
|
|
22
31
|
"slate-hyperscript": "0.81.3",
|
|
@@ -25,25 +34,22 @@
|
|
|
25
34
|
"devDependencies": {
|
|
26
35
|
"@types/node": "20.12.5",
|
|
27
36
|
"@types/react": "18.2.74",
|
|
28
|
-
"payload": "3.0.0-beta.9",
|
|
29
37
|
"@payloadcms/eslint-config": "1.1.1",
|
|
30
|
-
"@payloadcms/ui": "3.0.0-
|
|
38
|
+
"@payloadcms/ui": "3.0.0-canary.f6e77b8",
|
|
39
|
+
"payload": "3.0.0-canary.f6e77b8"
|
|
31
40
|
},
|
|
32
41
|
"peerDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@payloadcms/ui": "3.0.0-
|
|
42
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
43
|
+
"@payloadcms/translations": "3.0.0-canary.f6e77b8",
|
|
44
|
+
"@payloadcms/ui": "3.0.0-canary.f6e77b8",
|
|
45
|
+
"payload": "3.0.0-canary.f6e77b8"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=18.20.2"
|
|
36
49
|
},
|
|
37
|
-
"exports": null,
|
|
38
50
|
"publishConfig": {
|
|
39
51
|
"registry": "https://registry.npmjs.org/"
|
|
40
52
|
},
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": ">=18.17.0"
|
|
43
|
-
},
|
|
44
|
-
"files": [
|
|
45
|
-
"dist"
|
|
46
|
-
],
|
|
47
53
|
"scripts": {
|
|
48
54
|
"build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
|
|
49
55
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
package/src/index.tsx
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { RichTextAdapter } from 'payload/types'
|
|
2
|
-
|
|
3
|
-
import { withNullableJSONSchemaType } from 'payload/utilities'
|
|
4
|
-
|
|
5
|
-
import type { AdapterArguments } from './types.js'
|
|
6
|
-
|
|
7
|
-
import { RichTextCell } from './cell/index.js'
|
|
8
|
-
import { richTextRelationshipPromise } from './data/richTextRelationshipPromise.js'
|
|
9
|
-
import { richTextValidate } from './data/validation.js'
|
|
10
|
-
import { RichTextField } from './field/index.js'
|
|
11
|
-
import { getGenerateComponentMap } from './generateComponentMap.js'
|
|
12
|
-
import { getGenerateSchemaMap } from './generateSchemaMap.js'
|
|
13
|
-
|
|
14
|
-
export function slateEditor(args: AdapterArguments): RichTextAdapter<any[], AdapterArguments, any> {
|
|
15
|
-
return {
|
|
16
|
-
CellComponent: RichTextCell,
|
|
17
|
-
FieldComponent: RichTextField,
|
|
18
|
-
generateComponentMap: getGenerateComponentMap(args),
|
|
19
|
-
generateSchemaMap: getGenerateSchemaMap(args),
|
|
20
|
-
outputSchema: ({ isRequired }) => {
|
|
21
|
-
return {
|
|
22
|
-
type: withNullableJSONSchemaType('array', isRequired),
|
|
23
|
-
items: {
|
|
24
|
-
type: 'object',
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
populationPromise({
|
|
29
|
-
context,
|
|
30
|
-
currentDepth,
|
|
31
|
-
depth,
|
|
32
|
-
field,
|
|
33
|
-
findMany,
|
|
34
|
-
flattenLocales,
|
|
35
|
-
overrideAccess,
|
|
36
|
-
populationPromises,
|
|
37
|
-
req,
|
|
38
|
-
showHiddenFields,
|
|
39
|
-
siblingDoc,
|
|
40
|
-
}) {
|
|
41
|
-
if (
|
|
42
|
-
field.admin?.elements?.includes('relationship') ||
|
|
43
|
-
field.admin?.elements?.includes('upload') ||
|
|
44
|
-
field.admin?.elements?.includes('link') ||
|
|
45
|
-
!field?.admin?.elements
|
|
46
|
-
) {
|
|
47
|
-
return richTextRelationshipPromise({
|
|
48
|
-
context,
|
|
49
|
-
currentDepth,
|
|
50
|
-
depth,
|
|
51
|
-
field,
|
|
52
|
-
findMany,
|
|
53
|
-
flattenLocales,
|
|
54
|
-
overrideAccess,
|
|
55
|
-
populationPromises,
|
|
56
|
-
req,
|
|
57
|
-
showHiddenFields,
|
|
58
|
-
siblingDoc,
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
return null
|
|
62
|
-
},
|
|
63
|
-
validate: richTextValidate,
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { ElementButton } from './field/elements/Button.js'
|
|
68
|
-
|
|
69
|
-
export { toggleElement } from './field/elements/toggle.js'
|
|
70
|
-
export { LeafButton } from './field/leaves/Button.js'
|
|
71
|
-
export type {
|
|
72
|
-
AdapterArguments,
|
|
73
|
-
ElementNode,
|
|
74
|
-
FieldProps,
|
|
75
|
-
RichTextCustomElement,
|
|
76
|
-
RichTextCustomLeaf,
|
|
77
|
-
RichTextElement,
|
|
78
|
-
RichTextLeaf,
|
|
79
|
-
TextNode,
|
|
80
|
-
} from './types.js'
|
|
81
|
-
|
|
82
|
-
export { nodeIsTextNode } from './types.js'
|