chore: move to lexical for local testing

This commit is contained in:
James
2024-03-07 10:37:48 -05:00
parent 60e3b21596
commit 030ddbe12f
5 changed files with 116 additions and 117 deletions

View File

@@ -10,7 +10,7 @@ import { DefaultDashboard } from './Default/index.js'
export { generateDashboardMetadata } from './meta.js'
const Link = LinkDefault.default
const Link = LinkDefault
export const Dashboard: React.FC<AdminViewProps> = ({
initPageResult,

View File

@@ -6,7 +6,6 @@
"emitDeclarationOnly": true,
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"rootDir": "./src" /* Specify the root folder within your source files. */,
"allowImportingTsExtensions": true,
"sourceMap": true,
"paths": {
"@payloadcms/ui": ["../ui/src/exports/index.ts"],

View File

@@ -7,7 +7,7 @@ import { usePreferences } from '../../providers/Preferences/index.js'
import { useNav } from '../Nav/context.js'
import './index.scss'
const AnimateHeight = AnimateHeightImport.default
const AnimateHeight = AnimateHeightImport.default || AnimateHeightImport
const baseClass = 'nav-group'

View File

@@ -1,35 +1,35 @@
import path from 'path'
import sharp from 'sharp'
import type { Config, SanitizedConfig } from '../packages/payload/src/config/types'
import type { Config, SanitizedConfig } from '../packages/payload/src/config/types.d.ts'
import { mongooseAdapter } from '../packages/db-mongodb/src'
import { postgresAdapter } from '../packages/db-postgres/src'
import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build'
// import {
// AlignFeature,
// BlockQuoteFeature,
// BlocksFeature,
// BoldFeature,
// CheckListFeature,
// HeadingFeature,
// IndentFeature,
// InlineCodeFeature,
// ItalicFeature,
// LinkFeature,
// OrderedListFeature,
// ParagraphFeature,
// RelationshipFeature,
// StrikethroughFeature,
// SubscriptFeature,
// SuperscriptFeature,
// TreeViewFeature,
// UnderlineFeature,
// UnorderedListFeature,
// UploadFeature,
// lexicalEditor,
// } from '../packages/richtext-lexical/src'
import { slateEditor } from '../packages/richtext-slate/src'
import { mongooseAdapter } from '../packages/db-mongodb/src/index.js'
import { postgresAdapter } from '../packages/db-postgres/src/index.js'
import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build.js'
import {
AlignFeature,
BlockQuoteFeature,
BlocksFeature,
BoldFeature,
CheckListFeature,
HeadingFeature,
IndentFeature,
InlineCodeFeature,
ItalicFeature,
LinkFeature,
OrderedListFeature,
ParagraphFeature,
RelationshipFeature,
StrikethroughFeature,
SubscriptFeature,
SuperscriptFeature,
TreeViewFeature,
UnderlineFeature,
UnorderedListFeature,
UploadFeature,
lexicalEditor,
} from '../packages/richtext-lexical/src'
// import { slateEditor } from '../packages/richtext-slate/src/index.js'
// process.env.PAYLOAD_DATABASE = 'postgres'
@@ -66,42 +66,9 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
const config: Config = {
db: databaseAdapters[process.env.PAYLOAD_DATABASE || 'mongoose'],
secret: 'TEST_SECRET',
editor: slateEditor({
admin: {
upload: {
collections: {
media: {
fields: [
{
name: 'alt',
type: 'text',
},
],
},
},
},
},
}),
// editor: lexicalEditor({
// features: [
// ParagraphFeature(),
// RelationshipFeature(),
// LinkFeature({
// fields: [
// {
// name: 'description',
// type: 'text',
// },
// ],
// }),
// CheckListFeature(),
// UnorderedListFeature(),
// OrderedListFeature(),
// AlignFeature(),
// BlockQuoteFeature(),
// BoldFeature(),
// ItalicFeature(),
// UploadFeature({
// editor: slateEditor({
// admin: {
// upload: {
// collections: {
// media: {
// fields: [
@@ -112,56 +79,89 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
// ],
// },
// },
// }),
// UnderlineFeature(),
// StrikethroughFeature(),
// SubscriptFeature(),
// SuperscriptFeature(),
// InlineCodeFeature(),
// TreeViewFeature(),
// HeadingFeature(),
// IndentFeature(),
// BlocksFeature({
// blocks: [
// {
// slug: 'myBlock',
// fields: [
// {
// name: 'someText',
// type: 'text',
// },
// {
// name: 'someTextRequired',
// type: 'text',
// required: true,
// },
// {
// name: 'radios',
// type: 'radio',
// options: [
// {
// label: 'Option 1',
// value: 'option1',
// },
// {
// label: 'Option 2',
// value: 'option2',
// },
// {
// label: 'Option 3',
// value: 'option3',
// },
// ],
// validate: (value) => {
// return value !== 'option2' ? true : 'Cannot be option2'
// },
// },
// ],
// },
// ],
// }),
// ],
// },
// },
// }),
editor: lexicalEditor({
features: [
ParagraphFeature(),
RelationshipFeature(),
LinkFeature({
fields: [
{
name: 'description',
type: 'text',
},
],
}),
CheckListFeature(),
UnorderedListFeature(),
OrderedListFeature(),
AlignFeature(),
BlockQuoteFeature(),
BoldFeature(),
ItalicFeature(),
UploadFeature({
collections: {
media: {
fields: [
{
name: 'alt',
type: 'text',
},
],
},
},
}),
UnderlineFeature(),
StrikethroughFeature(),
SubscriptFeature(),
SuperscriptFeature(),
InlineCodeFeature(),
TreeViewFeature(),
HeadingFeature(),
IndentFeature(),
BlocksFeature({
blocks: [
{
slug: 'myBlock',
fields: [
{
name: 'someText',
type: 'text',
},
{
name: 'someTextRequired',
type: 'text',
required: true,
},
{
name: 'radios',
type: 'radio',
options: [
{
label: 'Option 1',
value: 'option1',
},
{
label: 'Option 2',
value: 'option2',
},
{
label: 'Option 3',
value: 'option3',
},
],
validate: (value) => {
return value !== 'option2' ? true : 'Cannot be option2'
},
},
],
},
],
}),
],
}),
sharp,
telemetry: false,
...testConfig,

View File

@@ -4,7 +4,7 @@
"declarationMap": true,
"module": "NodeNext",
"target": "esnext",
"moduleResolution": "NodeNext",
"moduleResolution": "Node16",
"allowJs": true,
"checkJs": false,
"esModuleInterop": true,