Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/richtext-lexical/src/field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ const RichTextComponent: React.FC<
/>
{AfterInput}
</ErrorBoundary>
{Description}
<RenderCustomComponent
CustomComponent={Description}
Fallback={<FieldDescription description={description} path={path} />}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/forms/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Form: React.FC<FormProps> = (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)
Expand Down
7 changes: 7 additions & 0 deletions test/lexical/collections/Lexical/components/Description.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Description = () => {
return (
<div className="lexical-blocks-custom-description" style={{ color: 'red' }}>
My Custom Lexical Description
</div>
)
}
23 changes: 23 additions & 0 deletions test/lexical/collections/Lexical/e2e/main/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions test/lexical/collections/Lexical/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ export const getLexicalFieldsCollection: (args: {
{
name: 'lexicalSimple',
type: 'richText',
admin: {
description: 'A simple lexical field',
},
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
//TestRecorderFeature(),
Expand Down Expand Up @@ -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,
Expand Down
Loading