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

added ...setInnerHtml to group-text and group-owner #1518

Merged
merged 3 commits into from
May 29, 2024

Conversation

OlofSvahnVbg
Copy link
Collaborator

closes #1517

@OlofSvahnVbg OlofSvahnVbg added the new feature Request for adding/changing functionality label May 29, 2024
@OlofSvahnVbg OlofSvahnVbg added this to the 3.x milestone May 29, 2024
@OlofSvahnVbg OlofSvahnVbg requested a review from Albinahmetaj May 29, 2024 05:29
@OlofSvahnVbg OlofSvahnVbg self-assigned this May 29, 2024
Albinahmetaj
Albinahmetaj previously approved these changes May 29, 2024
Copy link
Contributor

@Albinahmetaj Albinahmetaj left a comment

Choose a reason for hiding this comment

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

LGTM!

@jacobwod
Copy link
Member

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 pseudoSanitize is imported, just do:

           <div
            dangerouslySetInnerHTML={{
              __html: pseudoSanitize(userInputWithHtml),
            }} 
            />

@Albinahmetaj
Copy link
Contributor

Absolutely! Very useful snippet

@OlofSvahnVbg
Copy link
Collaborator Author

Should we merge without adding Jacobs function?

jesade-vbg
jesade-vbg previously approved these changes May 29, 2024
Copy link
Contributor

@jesade-vbg jesade-vbg left a 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.

@OlofSvahnVbg OlofSvahnVbg merged commit 39e50e5 into develop May 29, 2024
@OlofSvahnVbg OlofSvahnVbg deleted the feature/1517-adding-html-layergroup branch May 29, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request for adding/changing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants