From 1d8baf9beed15f0eadd79fa8a141e8391f9eab9a Mon Sep 17 00:00:00 2001 From: Simon Vreman Date: Tue, 7 Jan 2025 11:42:04 +0100 Subject: [PATCH] fix(richtext-lexical): remove alteration of lexical text format constant --- packages/richtext-lexical/src/features/typesClient.ts | 4 ++-- .../richtext-lexical/src/lexical/plugins/TextPlugin/index.tsx | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/richtext-lexical/src/features/typesClient.ts b/packages/richtext-lexical/src/features/typesClient.ts index 84dc726b86f..a29a7d06517 100644 --- a/packages/richtext-lexical/src/features/typesClient.ts +++ b/packages/richtext-lexical/src/features/typesClient.ts @@ -104,7 +104,7 @@ export type ClientFeature = { /** * The text formats which are enabled by this feature. */ - enableFormats?: Array> + enableFormats?: TextFormatType[] markdownTransformers?: ( | ((props: { allNodes: Array | LexicalNodeReplacement> @@ -214,7 +214,7 @@ export type ClientFeatureProviderMap = Map> + enabledFormats: TextFormatType[] markdownTransformers: Transformer[] /** diff --git a/packages/richtext-lexical/src/lexical/plugins/TextPlugin/index.tsx b/packages/richtext-lexical/src/lexical/plugins/TextPlugin/index.tsx index 0bd032d2a67..651e6d22705 100644 --- a/packages/richtext-lexical/src/lexical/plugins/TextPlugin/index.tsx +++ b/packages/richtext-lexical/src/lexical/plugins/TextPlugin/index.tsx @@ -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)