1
0
mirror of https://github.com/elk-zone/elk synced 2024-11-27 22:38:11 +09:00

fix: SSR render error on profile page

This commit is contained in:
三咲智子 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

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
}