mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-19 06:43:02 +08:00
Prevent tiptap from creating duplicate style tags when injecting css
This commit is contained in:
parent
71221f54d1
commit
52dd6e0e64
@ -1,6 +1,13 @@
|
||||
export default function createStyleTag(style: string): HTMLStyleElement {
|
||||
const tipTapStyleTag = (<HTMLStyleElement>document.querySelector('style[data-tiptap-style]'))
|
||||
|
||||
if (tipTapStyleTag !== null) {
|
||||
return tipTapStyleTag
|
||||
}
|
||||
|
||||
const styleNode = document.createElement('style')
|
||||
|
||||
styleNode.setAttribute('data-tiptap-style', '');
|
||||
styleNode.innerHTML = style
|
||||
document.getElementsByTagName('head')[0].appendChild(styleNode)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user