Compare commits
6 Commits
richtext-s
...
live-previ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7ea310e8b | ||
|
|
a8ac5d2cfd | ||
|
|
e6318ae700 | ||
|
|
f5166cd4c4 | ||
|
|
7c7bf51b4b | ||
|
|
eefcd88de7 |
2
.github/reproduction-guide.md
vendored
2
.github/reproduction-guide.md
vendored
@@ -61,4 +61,4 @@ Once they are installed you can open the `testing` tab in vscode sidebar and dri
|
||||
|
||||
#### Notes
|
||||
|
||||
The default credentials are `dev@payloadcms.com` as email and `test` as password. They can be found in `test/credentials.ts`. By default, these will be autofilled, so no log-in is required.
|
||||
- It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as email and `test` as password.
|
||||
|
||||
@@ -240,7 +240,6 @@ export const getTableColumnFromPath = ({
|
||||
let newTableName: string
|
||||
const hasBlockField = field.blocks.some((block) => {
|
||||
newTableName = `${tableName}_blocks_${toSnakeCase(block.slug)}`
|
||||
constraintPath = `${constraintPath}${field.name}.%.`
|
||||
let result
|
||||
const blockConstraints = []
|
||||
const blockSelectFields = {}
|
||||
@@ -248,7 +247,7 @@ export const getTableColumnFromPath = ({
|
||||
result = getTableColumnFromPath({
|
||||
adapter,
|
||||
collectionPath,
|
||||
constraintPath,
|
||||
constraintPath: '',
|
||||
constraints: blockConstraints,
|
||||
fields: block.fields,
|
||||
joinAliases,
|
||||
@@ -286,7 +285,7 @@ export const getTableColumnFromPath = ({
|
||||
adapter.tables[newTableName]._parentID,
|
||||
)
|
||||
}
|
||||
return true
|
||||
return result
|
||||
})
|
||||
if (hasBlockField) {
|
||||
return {
|
||||
@@ -295,7 +294,7 @@ export const getTableColumnFromPath = ({
|
||||
field: blockTableColumn.field,
|
||||
pathSegments: pathSegments.slice(1),
|
||||
rawColumn: blockTableColumn.rawColumn,
|
||||
table: blockTableColumn.table,
|
||||
table: adapter.tables[newTableName],
|
||||
}
|
||||
}
|
||||
if (pathSegments[1] === 'blockType') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@payloadcms/richtext-lexical",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.0",
|
||||
"description": "The officially supported Lexical richtext adapter for Payload",
|
||||
"repository": "https://github.com/payloadcms/payload",
|
||||
"license": "MIT",
|
||||
@@ -19,20 +19,20 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@faceless-ui/modal": "2.0.1",
|
||||
"@lexical/headless": "0.12.5",
|
||||
"@lexical/link": "0.12.5",
|
||||
"@lexical/list": "0.12.5",
|
||||
"@lexical/mark": "0.12.5",
|
||||
"@lexical/markdown": "0.12.5",
|
||||
"@lexical/react": "0.12.5",
|
||||
"@lexical/rich-text": "0.12.5",
|
||||
"@lexical/selection": "0.12.5",
|
||||
"@lexical/utils": "0.12.5",
|
||||
"@lexical/headless": "0.12.4",
|
||||
"@lexical/link": "0.12.4",
|
||||
"@lexical/list": "0.12.4",
|
||||
"@lexical/mark": "0.12.4",
|
||||
"@lexical/markdown": "0.12.4",
|
||||
"@lexical/react": "0.12.4",
|
||||
"@lexical/rich-text": "0.12.4",
|
||||
"@lexical/selection": "0.12.4",
|
||||
"@lexical/utils": "0.12.4",
|
||||
"bson-objectid": "2.0.4",
|
||||
"classnames": "^2.3.2",
|
||||
"deep-equal": "2.2.3",
|
||||
"i18next": "22.5.1",
|
||||
"lexical": "0.12.5",
|
||||
"lexical": "0.12.4",
|
||||
"lodash": "4.17.21",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { SerializedQuoteNode } from '@lexical/rich-text'
|
||||
|
||||
import { $createQuoteNode, QuoteNode } from '@lexical/rich-text'
|
||||
import { $setBlocksType } from '@lexical/selection'
|
||||
import { $INTERNAL_isPointSelection, $getSelection } from 'lexical'
|
||||
import { $getSelection, $isRangeSelection } from 'lexical'
|
||||
|
||||
import type { HTMLConverter } from '../converters/html/converter/types'
|
||||
import type { FeatureProvider } from '../types'
|
||||
@@ -31,7 +31,7 @@ export const BlockQuoteFeature = (): FeatureProvider => {
|
||||
onClick: ({ editor }) => {
|
||||
editor.update(() => {
|
||||
const selection = $getSelection()
|
||||
if ($INTERNAL_isPointSelection(selection)) {
|
||||
if ($isRangeSelection(selection)) {
|
||||
$setBlocksType(selection, () => $createQuoteNode())
|
||||
}
|
||||
})
|
||||
@@ -82,7 +82,7 @@ export const BlockQuoteFeature = (): FeatureProvider => {
|
||||
keywords: ['quote', 'blockquote'],
|
||||
onSelect: () => {
|
||||
const selection = $getSelection()
|
||||
if ($INTERNAL_isPointSelection(selection)) {
|
||||
if ($isRangeSelection(selection)) {
|
||||
$setBlocksType(selection, () => $createQuoteNode())
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { HeadingTagType, SerializedHeadingNode } from '@lexical/rich-text'
|
||||
|
||||
import { $createHeadingNode, HeadingNode } from '@lexical/rich-text'
|
||||
import { $setBlocksType } from '@lexical/selection'
|
||||
import { $INTERNAL_isPointSelection, $getSelection } from 'lexical'
|
||||
import { $getSelection, $isRangeSelection, DEPRECATED_$isGridSelection } from 'lexical'
|
||||
|
||||
import type { HTMLConverter } from '../converters/html/converter/types'
|
||||
import type { FeatureProvider } from '../types'
|
||||
@@ -14,7 +14,7 @@ import { MarkdownTransformer } from './markdownTransformer'
|
||||
|
||||
const setHeading = (headingSize: HeadingTagType) => {
|
||||
const selection = $getSelection()
|
||||
if ($INTERNAL_isPointSelection(selection)) {
|
||||
if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {
|
||||
$setBlocksType(selection, () => $createHeadingNode(headingSize))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import type { BaseSelection } from 'lexical'
|
||||
|
||||
import { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'
|
||||
import {
|
||||
$applyNodeReplacement,
|
||||
@@ -20,9 +18,11 @@ import {
|
||||
type DOMConversionOutput,
|
||||
type EditorConfig,
|
||||
ElementNode,
|
||||
type GridSelection,
|
||||
type LexicalCommand,
|
||||
type LexicalNode,
|
||||
type NodeKey,
|
||||
type NodeSelection,
|
||||
type RangeSelection,
|
||||
type SerializedElementNode,
|
||||
type Spread,
|
||||
@@ -146,7 +146,7 @@ export class LinkNode extends ElementNode {
|
||||
|
||||
extractWithChild(
|
||||
child: LexicalNode,
|
||||
selection: BaseSelection,
|
||||
selection: GridSelection | NodeSelection | RangeSelection,
|
||||
destination: 'clone' | 'html',
|
||||
): boolean {
|
||||
if (!$isRangeSelection(selection)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { $setBlocksType } from '@lexical/selection'
|
||||
import { $INTERNAL_isPointSelection, $createParagraphNode, $getSelection } from 'lexical'
|
||||
import { $createParagraphNode, $getSelection, $isRangeSelection } from 'lexical'
|
||||
|
||||
import type { FeatureProvider } from '../types'
|
||||
|
||||
@@ -23,7 +23,7 @@ export const ParagraphFeature = (): FeatureProvider => {
|
||||
onClick: ({ editor }) => {
|
||||
editor.update(() => {
|
||||
const selection = $getSelection()
|
||||
if ($INTERNAL_isPointSelection(selection)) {
|
||||
if ($isRangeSelection(selection)) {
|
||||
$setBlocksType(selection, () => $createParagraphNode())
|
||||
}
|
||||
})
|
||||
@@ -49,7 +49,7 @@ export const ParagraphFeature = (): FeatureProvider => {
|
||||
onSelect: ({ editor }) => {
|
||||
editor.update(() => {
|
||||
const selection = $getSelection()
|
||||
if ($INTERNAL_isPointSelection(selection)) {
|
||||
if ($isRangeSelection(selection)) {
|
||||
$setBlocksType(selection, () => $createParagraphNode())
|
||||
}
|
||||
})
|
||||
|
||||
@@ -98,33 +98,13 @@ export const lexicalHTML: (
|
||||
return result
|
||||
}
|
||||
}
|
||||
} else if ('blocks' in curField) {
|
||||
for (const block of curField.blocks) {
|
||||
if (block?.fields?.length) {
|
||||
const result = findFieldPathAndSiblingFields(block.fields, [
|
||||
...path,
|
||||
curField.name,
|
||||
block.slug,
|
||||
])
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
const { path, siblingFields } = findFieldPathAndSiblingFields(fields, [])
|
||||
|
||||
const foundSiblingFields = findFieldPathAndSiblingFields(fields, [])
|
||||
|
||||
if (!foundSiblingFields)
|
||||
throw new Error(
|
||||
`Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,
|
||||
)
|
||||
|
||||
const { siblingFields } = foundSiblingFields
|
||||
const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =
|
||||
siblingFields.find(
|
||||
(field) => 'name' in field && field.name === lexicalFieldName,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import type { BaseSelection, LexicalEditor } from 'lexical'
|
||||
import type { GridSelection, LexicalEditor, NodeSelection, RangeSelection } from 'lexical'
|
||||
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
||||
import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'
|
||||
@@ -141,7 +141,7 @@ function useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | nul
|
||||
const [isRecording, setIsRecording] = useState(false)
|
||||
const [, setCurrentInnerHTML] = useState('')
|
||||
const [templatedTest, setTemplatedTest] = useState('')
|
||||
const previousSelectionRef = useRef<BaseSelection | null>(null)
|
||||
const previousSelectionRef = useRef<GridSelection | NodeSelection | RangeSelection | null>(null)
|
||||
const skipNextSelectionChangeRef = useRef(false)
|
||||
const preRef = useRef<HTMLPreElement>(null)
|
||||
|
||||
|
||||
@@ -48,14 +48,11 @@ html[data-theme='light'] {
|
||||
|
||||
&-text {
|
||||
margin-left: 6px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: var(--color-base-500);
|
||||
min-width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,11 @@ export type LexicalEditorProps = {
|
||||
lexical?: LexicalEditorConfig
|
||||
}
|
||||
|
||||
export type LexicalRichTextAdapter = RichTextAdapter<SerializedEditorState, AdapterProps, any> & {
|
||||
export type LexicalRichTextAdapter = RichTextAdapter<
|
||||
SerializedEditorState,
|
||||
AdapterProps,
|
||||
AdapterProps
|
||||
> & {
|
||||
editorConfig: SanitizedEditorConfig
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@payloadcms/richtext-slate",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.0",
|
||||
"description": "The officially supported Slate richtext adapter for Payload",
|
||||
"repository": "https://github.com/payloadcms/payload",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -9,7 +9,9 @@ import { richTextRelationshipPromise } from './data/richTextRelationshipPromise'
|
||||
import { richTextValidate } from './data/validation'
|
||||
import RichTextField from './field'
|
||||
|
||||
export function slateEditor(args: AdapterArguments): RichTextAdapter<any[], AdapterArguments, any> {
|
||||
export function slateEditor(
|
||||
args: AdapterArguments,
|
||||
): RichTextAdapter<any[], AdapterArguments, AdapterArguments> {
|
||||
return {
|
||||
CellComponent: withMergedProps({
|
||||
Component: RichTextCell,
|
||||
|
||||
@@ -73,4 +73,4 @@ export type AdapterArguments = {
|
||||
}
|
||||
}
|
||||
|
||||
export type FieldProps = RichTextFieldProps<any[], AdapterArguments, AdapterArguments>
|
||||
export type FieldProps = RichTextFieldProps<any, AdapterArguments, AdapterArguments>
|
||||
|
||||
316
pnpm-lock.yaml
generated
316
pnpm-lock.yaml
generated
@@ -1313,32 +1313,32 @@ importers:
|
||||
specifier: 2.0.1
|
||||
version: 2.0.1(react-dom@18.2.0)(react@18.2.0)
|
||||
'@lexical/headless':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
'@lexical/link':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
'@lexical/list':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
'@lexical/mark':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
'@lexical/markdown':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/react':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.8)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.8)
|
||||
'@lexical/rich-text':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/selection':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils':
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5(lexical@0.12.5)
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4(lexical@0.12.4)
|
||||
bson-objectid:
|
||||
specifier: 2.0.4
|
||||
version: 2.0.4
|
||||
@@ -1352,8 +1352,8 @@ importers:
|
||||
specifier: 22.5.1
|
||||
version: 22.5.1
|
||||
lexical:
|
||||
specifier: 0.12.5
|
||||
version: 0.12.5
|
||||
specifier: 0.12.4
|
||||
version: 0.12.4
|
||||
lodash:
|
||||
specifier: 4.17.21
|
||||
version: 4.17.21
|
||||
@@ -3981,171 +3981,171 @@ packages:
|
||||
resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==}
|
||||
dev: true
|
||||
|
||||
/@lexical/clipboard@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-A0k0g5mCHDgROLF33TwiKdjMWEfajyPcIF64lsHapZ19ZTi1iabGkXvpHnyHaMq79py1Se/e6tOcmFe9nOJkrQ==}
|
||||
/@lexical/clipboard@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-kFR+UdhtLCMTQgZCyDmYzp2yjPFMNpUZ4TaRjuRBpCRFYwKMlgie4p1J4VJm6sT23kkAFZtVjOfp+gDEYnPHRQ==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/html': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/list': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/html': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/list': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/code@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-YV879sO2C0efWXgj4ZUzpowPWxbid8T5I0vysQIzuWPiaQG0fjilz1maYV+X95hD2VXW8yhyOnEdScfeKk62Zg==}
|
||||
/@lexical/code@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-pX7rJCjbjCl6VdOPl2hl/UkjP3iPPyCQgH2VQ+WlXapDd+0uZ54nPL1MKCCaFUZocHPmOmSRKKGUp6K2CNiqzg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
prismjs: 1.29.0
|
||||
dev: false
|
||||
|
||||
/@lexical/dragon@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-RFU6wIIUS0/ab5JtLp2rKaUi7nltDT96+GdmvNVHpAfa7TZuepYsoi7PtZB9aF/Outye4U7dQU2tNwesDBf8kg==}
|
||||
/@lexical/dragon@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-7DaXdQ/5GJ8HRpPYr2+SjaUi912tG9L6ukg9IglG1t51lWGxqLx2chW17tp50XDTtY05w9VnoMaxtgsuCN5Pmg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/hashtag@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-nlPFScTiuZgUtuBSnRkHK9AuRDV35zZug4JLG1Hkky+Fh1PJ+0MK+/K8mhoatp13zm7GqN2fMOrrUGufqEingw==}
|
||||
/@lexical/hashtag@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-iCxQRBZmgwAV6kypmxtWg7HVhBC7PKclmqLNaLDLoKBm+keEXpKnGB5iEtgK/tCMiwkzrg+wGcrw5qi+YjvM9Q==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/headless@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-Bj8ucxEO23mf8y6ZlAuXdnZWyUGte/gqnvR+t3DVnt6JKYMbVTD901JxsRU8PFrs1m4us338D842jf6pOPVTpQ==}
|
||||
/@lexical/headless@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-6UQNTpYtrk0lSY4u+sExG4jiIj2xmulas26BtHxeRPAbSrp67A9fCxSZ1I2w7us4XxBLRzWy0R8EmTnhzip83Q==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/history@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-nF5TurEE4qRbuNP/i5pDtVfWHQXb4ONof+MvKmHNfLRJbxSj7Ee33MVG9x851PjAzXoXuGJvw6FMBCasGXQx7A==}
|
||||
/@lexical/history@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-XLbSSr9FueAxuKHo4LBi+lZNVAEReNNDCt4MM2Ol8UZhWPlpNskSB/sECYEEQ6/ItlzgtnKyKWjfDFBHRWvC2g==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/html@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-OzsWKVcr9wUGvAbgyUdG+32/cI2RclI4I4JmIyfLbiYMBYdafu+j160cjohNWu9gQFjVFszIjG4CBxfwRM+Sag==}
|
||||
/@lexical/html@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-RD/n9n1eCuTZtLaTEI3wuUDlJjCn6j+/0c9GvzqLKhNz9f+E5zMVExhzTT4cZQh5WXbzGFNlwC/cuOtaM3wODg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/link@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-h7p5G+XXKqNrb4lk55mJL23Us5pz2szbzZevccADJ9Om6o3i4aNyjv1MeC29WXjmgS0YKHDlYcnKEgyAPKvVMw==}
|
||||
/@lexical/link@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-gmEs0GJGDhgwV1x0IrO7Br2GCALijZLIayGWoLAgYiXZee4WZpvjbngZuC6yghYBhrme6muPRMG2sLMwV2cWiQ==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/list@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-KNJ262krlpcDZ2U1LC8xp86uw2nqt88iEQgpF+khv3SAqqLbhT8tMpyZ6+eWbW3mHPhQIxFutJGazMAqMW3uUA==}
|
||||
/@lexical/list@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-qxwRIz+4Aj2u2fzyGPo86vX+1ebwCnamppr/c5ZWuqpRTWtYDWjq5LQKIwAvZBxCzPdtP5jzwyZ6VYWQXYW4Kg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/mark@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-61ctAYrxTGl4uMDTnE5fRH4yrs8sqnRyivuNWyOmQR6W/G3s0gHwkUZC7akOSnPLYhfnXRl3C4haY8pH93sWQg==}
|
||||
/@lexical/mark@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-NFFk/3AFFJARjsth8wd5HdeW8XhcaECoQ8wwnJ4fRZzgN0lu3ZSiq+CuVm0NRN5xA5KoUT6sfIQqGOzIPfvdsw==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/markdown@0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-F3cBcuhoGWxxCqERUXF4fYfJhceK7gFYQPRsXir5mYriSNZIQIMhJoeAt8Pjer0UjFyQvNfQ+AzzXHu5xYNLLA==}
|
||||
/@lexical/markdown@0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-cOk0dkafyvQI4DMwwMfkP329bRVfyhXcVF3dcRiydl6ZIgqOrj/EMi+C0qxQkcqg0MO26Rky6LLJ4vQi6AgJDg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/code': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/link': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/list': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/rich-text': 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5)
|
||||
'@lexical/text': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/code': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/link': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/list': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/rich-text': 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/text': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
transitivePeerDependencies:
|
||||
- '@lexical/clipboard'
|
||||
- '@lexical/selection'
|
||||
dev: false
|
||||
|
||||
/@lexical/offset@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-K+Mt4tOmwKarsJ1esdqNgN9Ep/JaeFa9ZQ7DKx8KIOkXL35nPb9NXuBvYyJjh1crP/iwsuP15kymgDjxj9ciMw==}
|
||||
/@lexical/offset@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-6fjXCx+YD1TMl6GFL4wowhBgbIg+UX3j2OOXh3F7WEp3SDvzoJsJ6F7xRctrHQbluCITM3oDwOyHa1J0m5lrFg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/overflow@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-boP1oTgBbNmbo8+1tgpDAs1P/lbTk4oWZ6x88E9VNVBJSkG2ZrmQKQoJzKzHwpjXbm+Cechf77JxfgTOabzYxw==}
|
||||
/@lexical/overflow@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-mEWgVukoOgcyDruHvzk1amy9jgGDVXFYiPn20ykxgrVQz6XEpq+lfyic/BUnN4toNR8p6jc/Yxi2lF1ELCU0Kg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/plain-text@0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-n24aQvTIy4AN+LaoQce6BIuSY4pUshiTp4OpiRh48o5c9NU0DmzEa0l9fBS1GfvjZL9bN5luiINFYn/bMB49nA==}
|
||||
/@lexical/plain-text@0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-osbqOyt19oFG0kTbV71jxxCdgnUqNYW6QXIIaS1SwcCN/N1CdFZ0sNpjPkHIFx9AdZ/Tmi4u9SNFUo16DjvThA==}
|
||||
peerDependencies:
|
||||
'@lexical/clipboard': 0.12.5
|
||||
'@lexical/selection': 0.12.5
|
||||
'@lexical/utils': 0.12.5
|
||||
lexical: 0.12.5
|
||||
'@lexical/clipboard': 0.12.4
|
||||
'@lexical/selection': 0.12.4
|
||||
'@lexical/utils': 0.12.4
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/clipboard': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/clipboard': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/react@0.12.5(lexical@0.12.5)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.8):
|
||||
resolution: {integrity: sha512-pAbJQksin223Yp1p1VsPKxkRtSppVij+HcLTzP89q2QuSA0z0p/T+f5jZjs8eV6tecMtmrjizhdLTbk0jkej1w==}
|
||||
/@lexical/react@0.12.4(lexical@0.12.4)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.8):
|
||||
resolution: {integrity: sha512-tz4ebqJ++YP/Y6FCjk5aU3bvgrps8+i9abqvaaNCSzSQavI0qHtdS7EGy4S9qyO6qKuthXcOGIQxGTweRTkDsA==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
react: '>=17.x'
|
||||
react-dom: '>=17.x'
|
||||
dependencies:
|
||||
'@lexical/clipboard': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/code': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/dragon': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/hashtag': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/history': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/link': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/list': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/mark': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/markdown': 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(lexical@0.12.5)
|
||||
'@lexical/overflow': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/plain-text': 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5)
|
||||
'@lexical/rich-text': 0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5)
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/table': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/text': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/yjs': 0.12.5(lexical@0.12.5)(yjs@13.6.8)
|
||||
lexical: 0.12.5
|
||||
'@lexical/clipboard': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/code': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/dragon': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/hashtag': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/history': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/link': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/list': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/mark': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/markdown': 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/overflow': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/plain-text': 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/rich-text': 0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4)
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/table': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/text': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/yjs': 0.12.4(lexical@0.12.4)(yjs@13.6.8)
|
||||
lexical: 0.12.4
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
react-error-boundary: 3.1.4(react@18.2.0)
|
||||
@@ -4153,64 +4153,64 @@ packages:
|
||||
- yjs
|
||||
dev: false
|
||||
|
||||
/@lexical/rich-text@0.12.5(@lexical/clipboard@0.12.5)(@lexical/selection@0.12.5)(@lexical/utils@0.12.5)(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-33R8ODRI5kKGbF70A/FWdISbbSPk+q4hKtiEJaV67zYPBuzrz0YHcni+tgKiykS05LgCksI/e43sfEkiykjrVQ==}
|
||||
/@lexical/rich-text@0.12.4(@lexical/clipboard@0.12.4)(@lexical/selection@0.12.4)(@lexical/utils@0.12.4)(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-gWMDmdRRFPk00JfQv52650qcpjTN6oBrrYwBydYvEG8WTC8o1k8qEOZaOFja6GElPt0520dpyvcWHTlIL0jv3Q==}
|
||||
peerDependencies:
|
||||
'@lexical/clipboard': 0.12.5
|
||||
'@lexical/selection': 0.12.5
|
||||
'@lexical/utils': 0.12.5
|
||||
lexical: 0.12.5
|
||||
'@lexical/clipboard': 0.12.4
|
||||
'@lexical/selection': 0.12.4
|
||||
'@lexical/utils': 0.12.4
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/clipboard': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/clipboard': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/selection@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-oWJ87T4j6plf2yQzElOeudUyv7kdwTkuhzTZbcCTBNH/cSMdp55/Kv2doBynxhfHYEceuBKE7f8rci//T9DUPQ==}
|
||||
/@lexical/selection@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-9lJt9PBJW7lWYiPDo/PGl2nZ6NrdYaDBidEoMNhyusPjeBEr35z4Hm0qWUhDrPDQPhK2i1oBw6nZa94bxuS9Lw==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/table@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-vgSTsjvGw+TrYYBmf3FR0kYJ+j1oOlBmrO1sqvuIrGPXKWmvYL+RbKIkm2xhtApVHVYgqfFvxNiZrPL5Wf9dXg==}
|
||||
/@lexical/table@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-Lyy6y1HOQqzU8O2cH5Zhzek46B0UU7NceM2fJKM7qiBSuxY/nE0BzkFq0xDk3x5W+vhXob6Z32sJSNFImtuqKw==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/utils': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/utils': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/text@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-PU1ntXQCqon3HTjrEPl/HdKB/boyW36vKgiPvojoaAhBhkEnuiN+Pq9hrexORBcZPyLFp6wYoWXjKSO4fJVYeA==}
|
||||
/@lexical/text@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-r/7402eCf6C/7BqUNR7ZLZQQjsE62wjeuf0rFeW1ulOpwiti/dFn1o+EsCb0hvNeHPzfGgRC+FuDT9KSEKu7Ig==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/utils@0.12.5(lexical@0.12.5):
|
||||
resolution: {integrity: sha512-wPVyvi1Cvtf7aHwVKlG/9RlgHxSUzpGvXm87t889Rg7uZfOteyvXHJStjpSCZ3pvZ60y5ETin4OoetaVZciPfw==}
|
||||
/@lexical/utils@0.12.4(lexical@0.12.4):
|
||||
resolution: {integrity: sha512-ColV11ANBY6deT7CdGwP4lzv3pb5caFfFLcVKdGDMMJSUYFQ5l69aZvDP2qWWnNqzGLb+AJSunMd142wWc5LGg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
dependencies:
|
||||
'@lexical/list': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/selection': 0.12.5(lexical@0.12.5)
|
||||
'@lexical/table': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/list': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/selection': 0.12.4(lexical@0.12.4)
|
||||
'@lexical/table': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
dev: false
|
||||
|
||||
/@lexical/yjs@0.12.5(lexical@0.12.5)(yjs@13.6.8):
|
||||
resolution: {integrity: sha512-GNiRND/8ePdTWuSDFloPo/1355V0ce6OtH/25qxCq5D9MLNiIkAcwqQfnWFUdOtVMuNJOVc4OfCE9ARCGuEjyQ==}
|
||||
/@lexical/yjs@0.12.4(lexical@0.12.4)(yjs@13.6.8):
|
||||
resolution: {integrity: sha512-qtCiABugE1CiZ7K5iFfQnB1KqfWtLyiRK0nxAaSxuZzQTO4+Kh3WDh7ULppPa53Sf3pKpw8Sq2XB4AXP6csbkg==}
|
||||
peerDependencies:
|
||||
lexical: 0.12.5
|
||||
lexical: 0.12.4
|
||||
yjs: '>=13.5.22'
|
||||
dependencies:
|
||||
'@lexical/offset': 0.12.5(lexical@0.12.5)
|
||||
lexical: 0.12.5
|
||||
'@lexical/offset': 0.12.4(lexical@0.12.4)
|
||||
lexical: 0.12.4
|
||||
yjs: 13.6.8
|
||||
dev: false
|
||||
|
||||
@@ -12762,8 +12762,8 @@ packages:
|
||||
resolution: {integrity: sha512-Kxavd+ETjxtVwG/hvPd6WZfXD44sLOKe9Vlkwxy7lBQ1qZArS+rZfs+u5iXwXe6tX9f2PIM0u3RHsrCEDDE0fw==}
|
||||
dev: true
|
||||
|
||||
/lexical@0.12.5:
|
||||
resolution: {integrity: sha512-ZMqisIxNe+JBqaUa1Qmz7ghpvnmARHxgYz+F0rcXRtSPZtgEL8OT2c9xk8CJ4ccVpf+qRQlONzCEIZfQQHd/RA==}
|
||||
/lexical@0.12.4:
|
||||
resolution: {integrity: sha512-giNrnp45H6P4IHFhkKaHEPTF+bKLBWdEIDL/FGjRZf+to7l7TORIBk/23Zdchzt/VGgKGWu950EOvGh53gkVMQ==}
|
||||
dev: false
|
||||
|
||||
/lib0@0.2.85:
|
||||
|
||||
@@ -5,6 +5,7 @@ import { mediaSlug } from '../Media'
|
||||
export const postsSlug = 'posts'
|
||||
|
||||
export const PostsCollection: CollectionConfig = {
|
||||
slug: postsSlug,
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
@@ -12,13 +13,12 @@ export const PostsCollection: CollectionConfig = {
|
||||
},
|
||||
{
|
||||
name: 'associatedMedia',
|
||||
type: 'upload',
|
||||
relationTo: mediaSlug,
|
||||
access: {
|
||||
create: () => true,
|
||||
update: () => false,
|
||||
},
|
||||
relationTo: mediaSlug,
|
||||
type: 'upload',
|
||||
},
|
||||
],
|
||||
slug: postsSlug,
|
||||
}
|
||||
|
||||
@@ -1,81 +1,88 @@
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
import type { BlockField } from '../../../../packages/payload/src/fields/config/types'
|
||||
|
||||
import { blockFieldsSlug, textFieldsSlug } from '../../slugs'
|
||||
import { blockFieldsSlug } from '../../slugs'
|
||||
import { AddCustomBlocks } from './components/AddCustomBlocks'
|
||||
import { getBlocksFieldSeedData } from './shared'
|
||||
|
||||
export const getBlocksField = (prefix?: string): BlockField => ({
|
||||
name: 'blocks',
|
||||
type: 'blocks',
|
||||
required: true,
|
||||
blocks: [
|
||||
{
|
||||
slug: prefix ? `${prefix}Content` : 'content',
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
required: true,
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'richText',
|
||||
type: 'richText',
|
||||
},
|
||||
],
|
||||
slug: prefix ? `${prefix}Content` : 'content',
|
||||
},
|
||||
{
|
||||
slug: prefix ? `${prefix}Number` : 'number',
|
||||
fields: [
|
||||
{
|
||||
name: 'number',
|
||||
required: true,
|
||||
type: 'number',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
slug: prefix ? `${prefix}Number` : 'number',
|
||||
},
|
||||
{
|
||||
slug: prefix ? `${prefix}SubBlocks` : 'subBlocks',
|
||||
fields: [
|
||||
{
|
||||
type: 'collapsible',
|
||||
label: 'Collapsible within Block',
|
||||
fields: [
|
||||
{
|
||||
name: 'subBlocks',
|
||||
type: 'blocks',
|
||||
blocks: [
|
||||
{
|
||||
slug: 'text',
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
required: true,
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
slug: 'text',
|
||||
},
|
||||
{
|
||||
slug: 'number',
|
||||
fields: [
|
||||
{
|
||||
name: 'number',
|
||||
required: true,
|
||||
type: 'number',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
slug: 'number',
|
||||
},
|
||||
],
|
||||
type: 'blocks',
|
||||
},
|
||||
],
|
||||
label: 'Collapsible within Block',
|
||||
type: 'collapsible',
|
||||
},
|
||||
],
|
||||
slug: prefix ? `${prefix}SubBlocks` : 'subBlocks',
|
||||
},
|
||||
{
|
||||
slug: prefix ? `${prefix}Tabs` : 'tabs',
|
||||
fields: [
|
||||
{
|
||||
type: 'tabs',
|
||||
tabs: [
|
||||
{
|
||||
label: 'Tab with Collapsible',
|
||||
fields: [
|
||||
{
|
||||
type: 'collapsible',
|
||||
label: 'Collapsible within Block',
|
||||
fields: [
|
||||
{
|
||||
// collapsible
|
||||
@@ -83,10 +90,9 @@ export const getBlocksField = (prefix?: string): BlockField => ({
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
label: 'Collapsible within Block',
|
||||
type: 'collapsible',
|
||||
},
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
{
|
||||
// collapsible
|
||||
@@ -94,33 +100,28 @@ export const getBlocksField = (prefix?: string): BlockField => ({
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
type: 'row',
|
||||
},
|
||||
],
|
||||
label: 'Tab with Collapsible',
|
||||
},
|
||||
],
|
||||
type: 'tabs',
|
||||
},
|
||||
],
|
||||
slug: prefix ? `${prefix}Tabs` : 'tabs',
|
||||
},
|
||||
],
|
||||
defaultValue: getBlocksFieldSeedData(prefix),
|
||||
required: true,
|
||||
type: 'blocks',
|
||||
})
|
||||
|
||||
const BlockFields: CollectionConfig = {
|
||||
slug: blockFieldsSlug,
|
||||
fields: [
|
||||
getBlocksField(),
|
||||
{
|
||||
...getBlocksField('localized'),
|
||||
name: 'collapsedByDefaultBlocks',
|
||||
localized: true,
|
||||
admin: {
|
||||
initCollapsed: true,
|
||||
},
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
...getBlocksField('localized'),
|
||||
@@ -128,152 +129,135 @@ const BlockFields: CollectionConfig = {
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
type: 'blocks',
|
||||
name: 'i18nBlocks',
|
||||
label: {
|
||||
en: 'Block en',
|
||||
es: 'Block es',
|
||||
},
|
||||
labels: {
|
||||
singular: {
|
||||
en: 'Block en',
|
||||
es: 'Block es',
|
||||
},
|
||||
plural: {
|
||||
en: 'Blocks en',
|
||||
es: 'Blocks es',
|
||||
},
|
||||
},
|
||||
blocks: [
|
||||
{
|
||||
slug: 'text',
|
||||
graphQL: {
|
||||
singularName: 'I18nText',
|
||||
},
|
||||
labels: {
|
||||
singular: {
|
||||
en: 'Text en',
|
||||
es: 'Text es',
|
||||
},
|
||||
plural: {
|
||||
en: 'Texts en',
|
||||
es: 'Texts es',
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
graphQL: {
|
||||
singularName: 'I18nText',
|
||||
},
|
||||
labels: {
|
||||
plural: {
|
||||
en: 'Texts en',
|
||||
es: 'Texts es',
|
||||
},
|
||||
singular: {
|
||||
en: 'Text en',
|
||||
es: 'Text es',
|
||||
},
|
||||
},
|
||||
slug: 'text',
|
||||
},
|
||||
],
|
||||
label: {
|
||||
en: 'Block en',
|
||||
es: 'Block es',
|
||||
},
|
||||
labels: {
|
||||
plural: {
|
||||
en: 'Blocks en',
|
||||
es: 'Blocks es',
|
||||
},
|
||||
singular: {
|
||||
en: 'Block en',
|
||||
es: 'Block es',
|
||||
},
|
||||
},
|
||||
type: 'blocks',
|
||||
},
|
||||
{
|
||||
type: 'blocks',
|
||||
name: 'blocksWithSimilarConfigs',
|
||||
blocks: [
|
||||
{
|
||||
slug: 'block-a',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title',
|
||||
required: true,
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
],
|
||||
slug: 'block-a',
|
||||
},
|
||||
{
|
||||
slug: 'block-b',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title2',
|
||||
required: true,
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
],
|
||||
slug: 'block-b',
|
||||
},
|
||||
],
|
||||
type: 'blocks',
|
||||
},
|
||||
{
|
||||
name: 'blocksWithMinRows',
|
||||
type: 'blocks',
|
||||
minRows: 2,
|
||||
blocks: [
|
||||
{
|
||||
slug: 'block',
|
||||
fields: [
|
||||
{
|
||||
name: 'blockTitle',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
slug: 'block',
|
||||
},
|
||||
],
|
||||
minRows: 2,
|
||||
type: 'blocks',
|
||||
},
|
||||
{
|
||||
name: 'customBlocks',
|
||||
type: 'blocks',
|
||||
blocks: [
|
||||
{
|
||||
slug: 'block-1',
|
||||
fields: [
|
||||
{
|
||||
name: 'block1Title',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
slug: 'block-1',
|
||||
},
|
||||
{
|
||||
slug: 'block-2',
|
||||
fields: [
|
||||
{
|
||||
name: 'block2Title',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
slug: 'block-2',
|
||||
},
|
||||
],
|
||||
type: 'blocks',
|
||||
},
|
||||
{
|
||||
name: 'relationshipBlocks',
|
||||
blocks: [
|
||||
{
|
||||
fields: [
|
||||
{
|
||||
name: 'relationship',
|
||||
relationTo: textFieldsSlug,
|
||||
type: 'relationship',
|
||||
},
|
||||
],
|
||||
slug: 'relationships',
|
||||
},
|
||||
],
|
||||
type: 'blocks',
|
||||
},
|
||||
{
|
||||
type: 'ui',
|
||||
name: 'ui',
|
||||
admin: {
|
||||
components: {
|
||||
Field: AddCustomBlocks,
|
||||
},
|
||||
},
|
||||
type: 'ui',
|
||||
},
|
||||
],
|
||||
slug: blockFieldsSlug,
|
||||
}
|
||||
|
||||
export default BlockFields
|
||||
|
||||
@@ -29,14 +29,7 @@ import {
|
||||
import { tabsDoc } from './collections/Tabs/shared'
|
||||
import { defaultText } from './collections/Text/shared'
|
||||
import { clearAndSeedEverything } from './seed'
|
||||
import {
|
||||
arrayFieldsSlug,
|
||||
blockFieldsSlug,
|
||||
groupFieldsSlug,
|
||||
relationshipFieldsSlug,
|
||||
tabsFieldsSlug,
|
||||
textFieldsSlug,
|
||||
} from './slugs'
|
||||
import { arrayFieldsSlug, groupFieldsSlug, relationshipFieldsSlug, tabsFieldsSlug } from './slugs'
|
||||
|
||||
let client: RESTClient
|
||||
let graphQLClient: GraphQLClient
|
||||
@@ -905,35 +898,6 @@ describe('Fields', () => {
|
||||
const { docs } = blockFields
|
||||
expect(docs).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('should query blocks with nested relationship', async () => {
|
||||
const textDoc = await payload.create({
|
||||
collection: textFieldsSlug,
|
||||
data: {
|
||||
text: 'test',
|
||||
},
|
||||
})
|
||||
const blockDoc = await payload.create({
|
||||
collection: blockFieldsSlug,
|
||||
data: {
|
||||
relationshipBlocks: [
|
||||
{
|
||||
blockType: 'relationships',
|
||||
relationship: textDoc.id,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
const result = await payload.find({
|
||||
collection: blockFieldsSlug,
|
||||
where: {
|
||||
'relationshipBlocks.relationship': { equals: textDoc.id },
|
||||
},
|
||||
})
|
||||
|
||||
expect(result.docs).toHaveLength(1)
|
||||
expect(result.docs[0]).toMatchObject(blockDoc)
|
||||
})
|
||||
})
|
||||
|
||||
describe('json', () => {
|
||||
|
||||
Reference in New Issue
Block a user