@yoopta/editor
Version:
<h2 align="center">Yoopta-Editor v1 🎉</h2> <p align="center">Yoopta-Editor - is an open source notion-like editor 💥</p> <div align="center"> <img width="574" alt="Screen Shot 2023-01-25 at 16 04 29" src="https://user-images.githubusercontent.com/2909311
31 lines • 1.61 kB
TypeScript
import type { Plugin, PluginDOMEvents, PluginElementRenderProps, PluginInputElements, PluginLifeCycleEvents, PluginOptions } from './types';
import type { SlateElement } from '../editor/types';
export type ExtendPluginRender<TKeys extends string> = {
[x in TKeys]: (props: PluginElementRenderProps) => JSX.Element;
};
export type ExtendPluginElementConfig = {
render?: (props: PluginElementRenderProps) => JSX.Element;
props?: Record<string, unknown>;
injectElementsFromPlugins?: YooptaPlugin<any, any>[];
placeholder?: string;
};
export type ExtendPlugin<TElementMap extends Record<string, SlateElement>, TOptions> = {
options?: Partial<PluginOptions<TOptions>>;
events?: Partial<PluginDOMEvents>;
lifecycle?: Partial<PluginLifeCycleEvents>;
injectElementsFromPlugins?: YooptaPlugin<any, any>[];
elements?: {
[K in keyof TElementMap]?: ExtendPluginElementConfig;
};
};
type PluginInput<TElementMap extends Record<string, SlateElement>, TOptions> = Omit<Plugin<TElementMap, TOptions>, 'elements'> & {
elements: PluginInputElements<TElementMap> | Plugin<TElementMap, TOptions>['elements'];
};
export declare class YooptaPlugin<TElementMap extends Record<string, SlateElement>, TOptions = Record<string, unknown>> {
private readonly plugin;
constructor(pluginInput: PluginInput<TElementMap, TOptions>);
get getPlugin(): Plugin<TElementMap, TOptions>;
extend(extendPlugin: ExtendPlugin<TElementMap, TOptions>): YooptaPlugin<TElementMap, TOptions>;
}
export {};
//# sourceMappingURL=create-yoopta-plugin.d.ts.map