-
Notifications
You must be signed in to change notification settings - Fork 49
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
added ...setInnerHtml to group-text and group-owner #1518
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hey guys! In another project, I recently had the same need of adding some user-supplied HTML. I came around this little snippet that will try to fix malformated HTML. Consider adding it to Hajk too, please! /**
* @summary Ensure that the supplied string isn't malformed by parsing it using the DOM.
* @description Please note that this function doesn't do any actual sanitizing, hence "pseudo".
* @param {string} html
* @returns
*/
export function pseudoSanitize(html: string) {
const doc = document.createElement("div");
doc.innerHTML = html;
return doc.innerHTML;
} And in another file, where <div
dangerouslySetInnerHTML={{
__html: pseudoSanitize(userInputWithHtml),
}}
/> |
Absolutely! Very useful snippet |
Should we merge without adding Jacobs function? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Lets add Jacobs stuff later in another issue.
closes #1517