@tiptap/core 3.7.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.7.2",
4
+ "version": "3.9.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,10 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "^3.7.2"
55
+ "@tiptap/pm": "^3.9.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@tiptap/pm": "^3.7.2"
58
+ "@tiptap/pm": "^3.9.0"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
package/src/Editor.ts CHANGED
@@ -57,6 +57,8 @@ export class Editor extends EventEmitter<EditorEvents> {
57
57
 
58
58
  private css: HTMLStyleElement | null = null
59
59
 
60
+ private className = 'tiptap'
61
+
60
62
  public schema!: Schema
61
63
 
62
64
  private editorView: EditorView | null = null
@@ -193,7 +195,8 @@ export class Editor extends EventEmitter<EditorEvents> {
193
195
  this.isInitialized = false
194
196
 
195
197
  // Safely remove CSS element with fallback for test environments
196
- if (this.css) {
198
+ // Only remove CSS if no other editors exist in the document after unmount
199
+ if (this.css && !document.querySelectorAll(`.${this.className}`).length) {
197
200
  try {
198
201
  if (typeof this.css.remove === 'function') {
199
202
  this.css.remove()
@@ -556,7 +559,7 @@ export class Editor extends EventEmitter<EditorEvents> {
556
559
  * Prepend class name to element.
557
560
  */
558
561
  public prependClass(): void {
559
- this.view.dom.className = `tiptap ${this.view.dom.className}`
562
+ this.view.dom.className = `${this.className} ${this.view.dom.className}`
560
563
  }
561
564
 
562
565
  public isCapturingTransaction = false