import type { Editor } from '@tiptap/core' type MountedEditorView = Editor['view'] export function getMountedEditorView(editor: Editor | null): MountedEditorView | null { if (!editor || editor.isDestroyed || typeof HTMLElement === 'undefined') return null try { const view = editor.view const { dom } = view return dom instanceof HTMLElement && !view.isDestroyed ? view : null } catch (error) { if (error instanceof Error && error.message.includes('The editor view is not available')) { return null } throw error } }