fix: SSR render error on profile page

zio/stable
三咲智子 2023-01-04 17:26:31 +08:00
parent a8135197c9
commit 8983edd1bb
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
1 changed files with 4 additions and 1 deletions

View File

@ -5,8 +5,11 @@ import { TEXT_NODE, parse, render, walkSync } from 'ultrahtml'
import { findAndReplaceEmojisInText } from '@iconify/utils'
import { emojiRegEx, getEmojiAttributes } from '../config/emojis'
const decoder = process.client ? document.createElement('textarea') : null as any as HTMLTextAreaElement
const decoder = process.client ? document.createElement('textarea') : null
export function decodeHtml(text: string) {
if (!decoder)
// not available when SSR
return text
decoder.innerHTML = text
return decoder.value
}