import type { Editor } from '@tiptap/react' export function isExtensionAvailable( editor: Editor | null, extensionNames: string | string[] ): boolean { if (!editor) return false const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames] const found = names.some((name) => editor.extensionManager.extensions.some((ext) => ext.name === name) ) if (!found) { console.warn( `None of the extensions [${names.join(', ')}] were found in the editor schema. Ensure they are included in the editor configuration.` ) } return found }