Skip to content
Discussion options

You must be logged in to vote

There are no custom text formats in lexical, only exactly the formats supported in TextFormatType. If you were using TypeScript you'd get a compile time error on the formatText call. You could use one of the existing formats for this purpose if your app doesn't otherwise need it (e.g. strikethrough or code). Some of the formats are mutually exclusive, a TextNode can have at most one of lowercase, capitalize, or uppercase for example, or at most one of superscript or subscript.

What you implemented is a custom TextNode subclass, which is not a format. You'd need to write the code to do the "format" by replacing the TextNodes in the selection with your custom node.

Another option for implem…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@peppies
Comment options

@etrepum
Comment options

etrepum Sep 23, 2025
Collaborator

@peppies
Comment options

Answer selected by peppies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants