Skip to content

Commit

Permalink
fix(richtext-lexical): allow any priority of FOCUS_COMMAND (#10128)
Browse files Browse the repository at this point in the history
This revert patch behavior on indent in Firefox, in order to fix #10049
  • Loading branch information
GermanJablo authored Jan 2, 2025
1 parent 510968f commit 018c193
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use client'

import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'
import { INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from 'lexical'

import type { ToolbarGroup } from '../../toolbars/types.js'

import { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js'
import { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js'
import { createClientFeature } from '../../../utilities/createClientFeature.js'
import { IndentPlugin } from './plugins/index.js'
import { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'

const toolbarGroups: ToolbarGroup[] = [
Expand Down Expand Up @@ -58,7 +58,7 @@ const toolbarGroups: ToolbarGroup[] = [
export const IndentFeatureClient = createClientFeature({
plugins: [
{
Component: IndentPlugin,
Component: TabIndentationPlugin,
position: 'normal',
},
],
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion packages/richtext-lexical/src/lexical/LexicalEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const LexicalEditor: React.FC<
<RichTextPlugin
contentEditable={
<div className="editor-scroller">
<div className="editor" ref={onRef} tabIndex={-1}>
<div className="editor" ref={onRef}>
<LexicalContentEditable editorConfig={editorConfig} />
</div>
</div>
Expand Down
7 changes: 2 additions & 5 deletions test/fields/collections/Lexical/e2e/main/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,11 +784,8 @@ describe('lexicalMain', () => {
})
})

/**
* When the escape key is pressed, Firefox resets the active element to the beginning of the page instead of staying with the editor.
* By applying a keydown listener when the escape key is pressed, we can programatically focus the previous element if shift+tab is pressed.
*/
test('ensure escape key can be used to move focus away from editor', async () => {
// NOTE: It's not worth it right now. Maybe later. See https://github.com/payloadcms/payload/issues/10049
test.skip('ensure escape key can be used to move focus away from editor', async () => {
await navigateToLexicalFields()

const richTextField = page.locator('.rich-text-lexical').first()
Expand Down

0 comments on commit 018c193

Please sign in to comment.