diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 2f69f5710f..f1700bfdb7 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -368,12 +368,14 @@ export class Editor extends EventEmitter { this.createNodeViews() this.prependClass() - // Let’s store the editor instance in the DOM element. - // So we’ll have access to it for tests. - // @ts-ignore - const dom = this.view.dom as TiptapEditorHTMLElement + if (typeof window !== 'undefined' && window.Cypress) { + // Let’s store the editor instance in the DOM element. + // So we’ll have access to it for tests. + // @ts-ignore + const dom = this.view.dom as TiptapEditorHTMLElement - dom.editor = this + dom.editor = this + } } /**