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

Change editor styling based on Regex #421

Open
amolpatel opened this issue Aug 5, 2022 · 7 comments
Open

Change editor styling based on Regex #421

amolpatel opened this issue Aug 5, 2022 · 7 comments

Comments

@amolpatel
Copy link

Hey all,

This is a great library, thanks for contributing! I have a quick question hoping someone could help me:

I would like to automatically update the styling for any text that matches a specific regex pattern in the editor. For example, if a user enters in any text in double curly braces, I want to change the color. Eg. {{text}} should highlight to green.

I know the library supports syntax highlighting but I was wondering if I can build any custom highlighting.

Thanks in advance!

@jaywcjlove
Copy link
Member

#420 (comment)

You can rerender the edit area. @amolpatel

components?: {
/** Use div to replace TextArea or re-render TextArea */
textarea?: ITextAreaProps['renderTextarea'];

@amolpatel
Copy link
Author

How does that help me use regex to replace a specific line of text? I'm also using Next so I have to use version 3.6.0 so have to use the deprecated renderTextarea

@jaywcjlove
Copy link
Member

@jaywcjlove
Copy link
Member

@amolpatel
Copy link
Author

Ah nice! Thanks for clarifying that. I still am not entirely sure how to accomplish syntax highlighting based on a specific regex pattern by re-rendering the text area. I guess I could do something similar to #195 (comment) but that seems quite hacky. Ideally, I could use Prism to highlight some syntax in the editor

@amolpatel
Copy link
Author

@jaywcjlove Any chance you can help with the above?

@jaywcjlove
Copy link
Member

@amolpatel Sorry I can't help you very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants