import React, { ComponentType, ReactElement } from 'react'; import { EditorPlugin } from '@draft-js-plugins/editor'; import addVideo from './video/modifiers/addVideo'; import DefaultVideoComponent, { DefaultVideoComponentProps, } from './video/components/DefaultVideoComponent'; import * as types from './video/constants'; import { defaultTheme, VideoPluginTheme } from './theme'; export type { VideoPluginTheme }; export interface VideoPluginConfig { theme?: VideoPluginTheme; videoComponent?: ComponentType; decorator?( component: ComponentType ): ComponentType; } export interface VideoPlugin extends EditorPlugin { addVideo: typeof addVideo; types: typeof types; } export default function videoPlugin( config: VideoPluginConfig = {} ): VideoPlugin { const theme = config.theme ? config.theme : defaultTheme; let Video = config.videoComponent || (DefaultVideoComponent as ComponentType); if (config.decorator) { Video = config.decorator(Video); } const ThemedVideo = (props: DefaultVideoComponentProps): ReactElement => (