import { EditorTools } from "@progress/kendo-react-editor";
//import { EditorToolTypes } from "../Widgets/Standard/Editor/EditorWidget";

const processTool = (tool: string) => {
  return EditorTools[tool.trim() as keyof typeof EditorTools];
};

export const generateEditorToolTypes = (editorTools: string): any[] => {
  return editorTools.split("|").map((item) => {
    if (item.includes("[")) {
      return item
        .replace("[", "")
        .replace("]", "")
        .split(",")
        .map(processTool) as any;
    } else {
      return processTool(item) as any;
    }
  });
};

export default generateEditorToolTypes;
