import { CorrectIcon } from '../../../../../icons/ai.js';

interface AIConfig {
  name: string;
  icon: any;
  hotkey: string | null;
  action: ({
    inlineEditors,
    targetInlineRanges,
    content,
  }: any) => void | Promise<void>;
}

export const textDealConfig: AIConfig[] = [
  {
    name: 'Replace selection',
    icon: CorrectIcon,
    hotkey: null,
    action: ({ inlineEditors, targetInlineRanges, content }) => {
      inlineEditors.forEach((inlineEditor: any, index: number) => {
        if (index === 0) {
          inlineEditor.insertText(targetInlineRanges[index], content);
        } else {
          inlineEditor.deleteText(targetInlineRanges[index]);
        }
      });
      // inlineEditor.setInlineRange({
      // 	index: targetInlineRange.index,
      // 	length: content.length
      // });
    },
  },
];
