import { Editor, Shortcuts } from "@progress/kendo-react-editor";
import { EditorChangeEvent as KendoEditorChangeEvent } from "@progress/kendo-react-editor";
import { EditorExecuteEvent as KendoEditorExecuteEvent } from "@progress/kendo-react-editor";
import { Node as ProseMirrorNode } from "prosemirror-model";

export interface EditorProps {
  dataTestId?: string;
  children?: React.ReactNode;
  ariaDescribedBy?: string;
  ariaLabel?: string;
  ariaLabelledBy?: string;
  className?: string;
  contentStyle?: React.CSSProperties;
  defaultContent?: string;
  defaultEditMode?: "div" | "iframe";
  dir?: string;
  keyboardNavigation?: boolean;
  preserveWhitespace?: boolean | "full";
  resizable?: boolean;
  style?: React.CSSProperties;
  tools?: any[];
  value?: string | ProseMirrorNode;
  onBlur?: (event: EditorBlurEvent) => void;
  onChange?: (event: KendoEditorChangeEvent) => void;
  onExecute?: (event: KendoEditorExecuteEvent) => boolean | void;
  onFocus?: (event: EditorFocusEvent) => void;
  onMount?: (event: EditorMountEvent) => void | EditorView;
  onPasteHtml?: (event: EditorPasteEvent) => string | void;
}

type EditorView = any;

export interface EditorBlurEvent {
  nativeEvent: FocusEvent;
  target: Editor;
}

export interface EditorFocusEvent {
  nativeEvent: FocusEvent;
  target: Editor;
}

export interface EditorMountEvent {
  dom: HTMLDivElement;
  shortcuts: Shortcuts;
  target: Editor;
  viewProps: { [key: string]: any };
}

export interface EditorPasteEvent {
  nativeEvent: ClipboardEvent;
  pastedHtml: string;
  target: Editor;
}

export interface PasteCleanupSettings {
  attributes?: { [attributeName: string]: (attr: Attr) => void };
  convertMsLists?: boolean;
  stripTags?: string;
}
