Inject theme object in my custom TextNode class #4083
Unanswered
mihajlovco
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi to all,
I need to implement a toolbar action where the user can select a
theme color
and apply to the selected text. Theme color can be changed in settings so the changes on the theme color need to be reflected in the text.From the technical perspective, I need to set the theme color variable to the node and save it as a data attribute, map the theme color, and apply the color style.
This is the theme colors object:
Render
When I need to render the text I need to take the new theme object (new from the react hook - API) and apply the new color.
example:
__themeStyles.colors[color1]
My implementation
I have implemented a custom TextNode
Lexical Paragraph 1
I have 2 questions:
importJSON
method in my custom node class so I can take the theme color.bold
or italic action.Beta Was this translation helpful? Give feedback.
All reactions