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

Strip tags on clearThought #801

Merged
merged 3 commits into from
Jul 23, 2020

Conversation

shresthabijay
Copy link
Contributor

fixes #743

@shresthabijay
Copy link
Contributor Author

@raineorshine We cannot render html within placeholder so it would make sense to just strip away all the tags. What do you think ?

@raineorshine
Copy link
Contributor

Yes, that's correct. It won't have any non-formatting tags anyway since they have already been stripped out during editing.

@@ -4,6 +4,8 @@ import {
setSelection,
} from '../util'

const tagsRegex = /<(?:.|\n)*?>/gmi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently have two other regex definitions that strip tags/html. Could you assess whether they can be combined into a single regex, and if so, have them all (including clearThought) reference that regex from constants? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raineorshine The REGEXP_HTML in constants /<\/?[a-z][\s\S]*>/i doesn't do strict tag checks. <p>test> as a whole will pass the regex test. Is this intentional ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REGEXP_HTML is currently used to detect HTML, not replace tags. I'm not sure what you mean by "strict tag checks."

You should be able to see exactly where each of the HTML-related regular expressions are being used, and determine if any of them can be combined based on their use.

@raineorshine
Copy link
Contributor

@shresthabijay Any updates on this?

@shresthabijay
Copy link
Contributor Author

@raineorshine The REGEXP_HTML is quite different from the regex used for tags in hashThought. But the tags regex used in clear thought is same as used in hashThought, so I exported it as a separate constant.

@raineorshine
Copy link
Contributor

Perfect, thanks!

@raineorshine raineorshine merged commit 193e884 into cybersemics:dev Jul 23, 2020
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

Successfully merging this pull request may close these issues.

Strip formatting tags from placeholder text
2 participants