diff --git a/docs/authentication/overview.mdx b/docs/authentication/overview.mdx index 4a70096539..c32ea9074d 100644 --- a/docs/authentication/overview.mdx +++ b/docs/authentication/overview.mdx @@ -151,8 +151,8 @@ export default buildConfig({ prefillOnly: true, } : false, - } - + }, + // highlight-end }) ``` diff --git a/packages/richtext-lexical/src/lexical/LexicalEditor.tsx b/packages/richtext-lexical/src/lexical/LexicalEditor.tsx index aa3a5f3d28..d7a2ddf182 100644 --- a/packages/richtext-lexical/src/lexical/LexicalEditor.tsx +++ b/packages/richtext-lexical/src/lexical/LexicalEditor.tsx @@ -19,6 +19,7 @@ import { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/ind import { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js' import { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js' import { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js' +import { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js' import { SlashMenuPlugin } from './plugins/SlashMenu/index.js' import { TextPlugin } from './plugins/TextPlugin/index.js' import { LexicalContentEditable } from './ui/ContentEditable.js' @@ -111,6 +112,7 @@ export const LexicalEditor: React.FC< + { + return editor.registerCommand( + SELECT_ALL_COMMAND, + () => { + const selection = $getSelection() + if (selection) { + return false + } + const activeElement = document.activeElement + if (activeElement instanceof HTMLInputElement) { + activeElement.select() + } + return true + }, + COMMAND_PRIORITY_LOW, + ) + }, [editor]) + + return null +} diff --git a/test/database/up-down-migration/migrations/20250528_153134.ts b/test/database/up-down-migration/migrations/20250528_153134.ts index 086047bb65..5409567eee 100644 --- a/test/database/up-down-migration/migrations/20250528_153134.ts +++ b/test/database/up-down-migration/migrations/20250528_153134.ts @@ -1,4 +1,4 @@ -import type { MigrateDownArgs, MigrateUpArgs} from '@payloadcms/db-postgres'; +import type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-postgres' import { sql } from '@payloadcms/db-postgres' diff --git a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts index 7881f37a48..9e42481b70 100644 --- a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts +++ b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts @@ -62,6 +62,24 @@ describe('Lexical Fully Featured', () => { const paragraph = lexical.editor.locator('> p') await expect(paragraph).toHaveText('') }) + + test('ControlOrMeta+A inside input should select all the text inside the input', async ({ + page, + }) => { + const lexical = new LexicalHelpers(page) + await lexical.editor.first().focus() + await page.keyboard.type('Hello') + await page.keyboard.press('Enter') + await lexical.slashCommand('block') + await page.locator('#field-someText').first().focus() + await page.keyboard.type('World') + await page.keyboard.press('ControlOrMeta+A') + await page.keyboard.press('Backspace') + const paragraph = lexical.editor.locator('> p').first() + await expect(paragraph).toHaveText('Hello') + await expect(page.getByText('World')).toHaveCount(0) + }) + test('text state feature', async ({ page }) => { await page.keyboard.type('Hello') await page.keyboard.press('ControlOrMeta+A') diff --git a/tsconfig.base.json b/tsconfig.base.json index 451c9cfdae..8d0bb793bc 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -31,7 +31,7 @@ } ], "paths": { - "@payload-config": ["./test/query-presets/config.ts"], + "@payload-config": ["./test/_community/config.ts"], "@payloadcms/admin-bar": ["./packages/admin-bar/src"], "@payloadcms/live-preview": ["./packages/live-preview/src"], "@payloadcms/live-preview-react": ["./packages/live-preview-react/src/index.ts"],