Skip to content

Commit

Permalink
feat(core): add the ability to register CSS via extension
Browse files Browse the repository at this point in the history
  • Loading branch information
svenadlung committed Jul 17, 2023
1 parent 849704c commit 7f2c619
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/utilities/createStyleTag.ts
@@ -1,5 +1,5 @@
export function createStyleTag(style: string, nonce?: string): HTMLStyleElement {
const tiptapStyleTag = (<HTMLStyleElement>document.querySelector('style[data-tiptap-style]'))
export function createStyleTag(style: string, nonce?: string, suffix?: string): HTMLStyleElement {
const tiptapStyleTag = (<HTMLStyleElement>document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`))

if (tiptapStyleTag !== null) {
return tiptapStyleTag
Expand All @@ -11,7 +11,7 @@ export function createStyleTag(style: string, nonce?: string): HTMLStyleElement
styleNode.setAttribute('nonce', nonce)
}

styleNode.setAttribute('data-tiptap-style', '')
styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ''}`, '')
styleNode.innerHTML = style
document.getElementsByTagName('head')[0].appendChild(styleNode)

Expand Down

0 comments on commit 7f2c619

Please sign in to comment.