mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-24 01:17:50 +08:00
16 lines
379 B
TypeScript
16 lines
379 B
TypeScript
export default function injectCSS(css: string) {
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
const style = document.createElement('style')
|
|
style.type = 'text/css'
|
|
style.textContent = css
|
|
const { head } = document
|
|
const { firstChild } = head
|
|
|
|
if (firstChild) {
|
|
head.insertBefore(style, firstChild)
|
|
} else {
|
|
head.appendChild(style)
|
|
}
|
|
}
|
|
}
|