From 36bd3ad3467f74812cc3a717e484d9f98b83281b Mon Sep 17 00:00:00 2001 From: svenadlung Date: Mon, 17 Jul 2023 09:06:31 +0200 Subject: [PATCH] allow extensions to create their own styles --- packages/core/src/utilities/createStyleTag.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/utilities/createStyleTag.ts b/packages/core/src/utilities/createStyleTag.ts index 8095d20ef99..ef07e1032a1 100644 --- a/packages/core/src/utilities/createStyleTag.ts +++ b/packages/core/src/utilities/createStyleTag.ts @@ -1,5 +1,5 @@ -export function createStyleTag(style: string, nonce?: string): HTMLStyleElement { - const tiptapStyleTag = (document.querySelector('style[data-tiptap-style]')) +export function createStyleTag(style: string, nonce?: string, suffix?: string): HTMLStyleElement { + const tiptapStyleTag = (document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`)) if (tiptapStyleTag !== null) { return tiptapStyleTag @@ -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)