Skip to content

Commit

Permalink
utils: decodeHtmlEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
denisavitski committed Jan 6, 2025
1 parent ae96a40 commit 58d1b7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aptechka",
"version": "0.50.14",
"version": "0.50.15",
"repository": {
"type": "git",
"url": "git+https://github.com/denisavitski/aptechka.git"
Expand Down
10 changes: 10 additions & 0 deletions src/components/packages/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ export function generateId(
export function isUppercase(string: string) {
return /^\p{Lu}/u.test(string)
}

let textarea: HTMLTextAreaElement | null
export function decodeHtmlEntities(html: string) {
if (!textarea) {
textarea = document.createElement('textarea')
}

textarea.innerHTML = html
return textarea.value
}

0 comments on commit 58d1b7e

Please sign in to comment.