tiptap/packages/tiptap-core/src/utils/injectCSS.ts

16 lines
370 B
TypeScript
Raw Normal View History

2020-03-05 04:45:49 +08:00
export default function (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)
}
}
}