chore: update typings to not conflict with globals

This commit is contained in:
Nick the Sick 2024-07-19 14:30:55 +02:00
parent 4cca382695
commit 3b67e8adc6
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
3 changed files with 242 additions and 239 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/core": patch
---
This changes the typing to not declare types on all HTMLElements, just a local one with the editor instance attached

468
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,8 @@ import { isFunction } from './utilities/isFunction.js'
export * as extensions from './extensions/index.js'
declare global {
interface HTMLElement {
editor?: Editor;
}
export interface TiptapEditorHTMLElement extends HTMLElement {
editor?: Editor
}
export class Editor extends EventEmitter<EditorEvents> {
@ -342,7 +340,7 @@ export class Editor extends EventEmitter<EditorEvents> {
// Lets store the editor instance in the DOM element.
// So well have access to it for tests.
const dom = this.view.dom as HTMLElement
const dom = this.view.dom as TiptapEditorHTMLElement
dom.editor = this
}