import { FC, WebCellProps } from 'web-cell'; import { ColorName, ColorTool, ForeColorTool as FCT, BackColorTool as BCT } from 'edkit'; export interface ColorSelectorProps extends Omit< WebCellProps, 'onChange' > { icon: string; type: ColorName; value?: string; onChange?: (color: string) => any; } export const ColorSelector: FC = ({ className = '', title, type, value, onChange, icon }) => ( onChange?.((target as HTMLInputElement).value) } /> ); export function renderColorTool(this: ColorTool, editor: HTMLElement) { const { icon, name, colorName } = this; return ( this.execute(editor, color)} /> ); } export class ForeColorTool extends FCT { icon = 'file-earmark-font'; render = renderColorTool; } export class BackColorTool extends BCT { icon = 'file-earmark-font-fill'; render = renderColorTool; }