Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(richtext-lexical): remove alteration of lexical text format constant #10415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions packages/richtext-lexical/src/features/typesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export type ClientFeature<ClientFeatureProps> = {
/**
* The text formats which are enabled by this feature.
*/
enableFormats?: Array<Omit<TextFormatType, 'highlight'>>
enableFormats?: TextFormatType[]
markdownTransformers?: (
| ((props: {
allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>
Expand Down Expand Up @@ -214,7 +214,7 @@ export type ClientFeatureProviderMap = Map<string, FeatureProviderClient<any, an
export type SanitizedClientFeatures = {
/** The keys of all enabled features */
enabledFeatures: string[]
enabledFormats: Array<Omit<TextFormatType, 'highlight'>>
enabledFormats: TextFormatType[]
markdownTransformers: Transformer[]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export function TextPlugin({ features }: { features: SanitizedClientFeatures })
}

function getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {
// not sure why Lexical added highlight as TextNode format.
// see https://github.com/facebook/lexical/pull/3583
// We are going to implement it in other way to support multiple colors
delete TEXT_TYPE_TO_FORMAT.highlight
const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]
const enabledSet = new Set(enabledFormats)

Expand Down