Suggested Refactor of Core Field Components #36
58bits
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think the current structure of the top-level components in /src/fields/LexicalRichText is a little difficult to follow.
Here's a suggested refactor and a new set of filenames...
EditorConfigProvider.tsx- the editor config provider – extract this fromLexicalEditorComponent.tsxEditorProviders.tsx(currentlyLexicalEditorComponent.tsx) – it’s quite common in react projects to group all providers into a single component. Not sure why Lexical named them with ‘Context’ suffixes, because in most other React projects they’re named ‘Providers’ – but this doesn’t really matter a lot.Editor.tsx(currentlyLexicalRichText.tsx– although you’re actually exporting Editor)FieldComponent.tsx(currentlyPayloadLexicalRichTextFieldComponent.tsx)FieldComponentLazy.tsx(currentlyindex.tsx)index.tsx- make this thelexicalRichTextField.tsfile and bring it down into this same directory as the LexicalRichText folderLexicalAfterReadHook.ts– also move this down into the LexicalRichText directorySo the final directory structure would look like this...
Beta Was this translation helpful? Give feedback.
All reactions