diff --git a/packages/richtext-lexical/src/field/Field.tsx b/packages/richtext-lexical/src/field/Field.tsx index 71da30774a4..e87ea5d9a14 100644 --- a/packages/richtext-lexical/src/field/Field.tsx +++ b/packages/richtext-lexical/src/field/Field.tsx @@ -184,7 +184,6 @@ const RichTextComponent: React.FC< /> {AfterInput} - {Description} } diff --git a/packages/ui/src/forms/Form/index.tsx b/packages/ui/src/forms/Form/index.tsx index 5a961900992..b5c606cf5b7 100644 --- a/packages/ui/src/forms/Form/index.tsx +++ b/packages/ui/src/forms/Form/index.tsx @@ -104,7 +104,7 @@ export const Form: React.FC = (props) => { const { startRouteTransition } = useRouteTransition() const { getUploadHandler } = useUploadHandlers() - const { config, getEntityConfig } = useConfig() + const { config } = useConfig() const [disabled, setDisabled] = useState(disabledFromProps || false) const [isMounted, setIsMounted] = useState(false) diff --git a/test/lexical/collections/Lexical/components/Description.tsx b/test/lexical/collections/Lexical/components/Description.tsx new file mode 100644 index 00000000000..babca73645b --- /dev/null +++ b/test/lexical/collections/Lexical/components/Description.tsx @@ -0,0 +1,7 @@ +export const Description = () => { + return ( +
+ My Custom Lexical Description +
+ ) +} diff --git a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts index 5451d54f466..0f44be890cf 100644 --- a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts @@ -1446,6 +1446,29 @@ describe('lexicalMain', () => { page.getByText('Creating new User') }) + test('ensure custom Description component is rendered only once', async () => { + await navigateToLexicalFields() + const lexicalWithBlocks = page.locator('.rich-text-lexical').nth(2) + await lexicalWithBlocks.scrollIntoViewIfNeeded() + await expect(lexicalWithBlocks).toBeVisible() + + await expect(lexicalWithBlocks.locator('.lexical-blocks-custom-description')).toHaveCount(1) + await expect(lexicalWithBlocks.locator('.lexical-blocks-custom-description')).toBeVisible() + + await expect(lexicalWithBlocks.locator('.field-description')).toHaveCount(0) + }) + + test('ensure admin.description property is rendered', async () => { + await navigateToLexicalFields() + const lexicalSimple = page.locator('.rich-text-lexical').nth(1) + await lexicalSimple.scrollIntoViewIfNeeded() + await expect(lexicalSimple).toBeVisible() + + await expect(lexicalSimple.locator('.field-description')).toHaveCount(1) + await expect(lexicalSimple.locator('.field-description')).toBeVisible() + await expect(lexicalSimple.locator('.field-description')).toHaveText('A simple lexical field') + }) + test('ensure links can created from clipboard and deleted', async () => { await navigateToLexicalFields() const richTextField = page.locator('.rich-text-lexical').first() diff --git a/test/lexical/collections/Lexical/index.ts b/test/lexical/collections/Lexical/index.ts index 6cb00b0d0aa..8a539829f0c 100644 --- a/test/lexical/collections/Lexical/index.ts +++ b/test/lexical/collections/Lexical/index.ts @@ -309,6 +309,9 @@ export const getLexicalFieldsCollection: (args: { { name: 'lexicalSimple', type: 'richText', + admin: { + description: 'A simple lexical field', + }, editor: lexicalEditor({ features: ({ defaultFeatures }) => [ //TestRecorderFeature(), @@ -347,6 +350,12 @@ export const getLexicalFieldsCollection: (args: { { name: 'lexicalWithBlocks', type: 'richText', + admin: { + components: { + Description: '/collections/Lexical/components/Description.js#Description', + }, + description: 'Should not be rendered', + }, editor: lexicalEditor({ admin: { hideGutter: false,