@prisma-cms/editor
Version:
Editor for @prisma-cms
101 lines (100 loc) • 3.64 kB
TypeScript
import React, { PureComponent } from 'react';
import { EditorState, ContentState, CompositeDecorator, ContentBlock, DraftEditorCommand, DraftHandleValue, DraftBlockRenderMap } from 'draft-js-android-fix';
import { PrismaCmsEditorProps, PrismaCmsEditorState } from './interfaces';
export * from './interfaces';
export declare const styles: {
root: {
'&.PrismaEditor--editable': {
'& .DraftEditor-root': {
'& > .DraftEditor-editorContainer': {
'& > .public-DraftEditor-content': {
'& > div[data-contents=true]': {
border: string;
padding: number;
};
};
};
};
};
'& .DraftEditor-root': {
'& > .DraftEditor-editorContainer': {
'& > .public-DraftEditor-content': {
'& figure': {
margin: string;
};
};
};
};
};
menu: {
padding: number;
border: string;
marginBottom: number;
};
iconButton: {
height: string;
width: string;
'& svg': {
height: string;
fontSize: string;
};
};
};
export declare class PrismaEditor<P extends PrismaCmsEditorProps = PrismaCmsEditorProps, S extends PrismaCmsEditorState = PrismaCmsEditorState> extends PureComponent<P, S> {
static defaultProps: {
readOnly: boolean;
spellCheck: boolean;
decorators: never[];
defaultBlockRenderMap: boolean;
plugins: never[];
show_toolbar: boolean;
LinkComponent: React.FC<import("next/link").LinkProps & {
children?: React.ReactNode | undefined;
} & {
to?: string;
}>;
};
constructor(props: P);
componentDidMount(): void;
initState(value: P['value']): {
editorState: EditorState;
rawContent: P["value"];
};
getCompositeDecorator: () => CompositeDecorator;
getEditorState: () => S["editorState"];
isReadOnly: () => P["readOnly"] | undefined;
componentDidUpdate(prevProps: P): void;
onChange: (editorState: EditorState) => void;
getBlockRenderMap(): DraftBlockRenderMap;
blockRenderer: (block: ContentBlock) => {
component: React.ComponentType<import("material-ui/styles/withStyles").StyledComponentProps<"row" | "chip" | "svgIcon">>;
editable: boolean;
props: {
allow_edit: boolean;
onStartEdit: () => void;
onFinishEdit: (_blockKey: string, newContentState: ContentState) => void;
_insertText: () => void;
onRemove: (blockKey: string) => void;
};
} | {
component: React.ComponentType<import("material-ui/styles/withStyles").StyledComponentProps<"root" | "dialog" | "img" | "dialogContent" | "thumb">>;
editable: boolean;
props: {
allow_edit?: undefined;
onStartEdit?: undefined;
onFinishEdit?: undefined;
_insertText?: undefined;
onRemove?: undefined;
};
} | null;
_insertText: () => void;
_removeTeX: (blockKey: string) => void;
insertCodeBlock: () => void;
onEditStart: () => void;
onEditEnd: () => void;
toggleInlineStyle(style: string): DraftHandleValue;
handleKeyCommand: (command: DraftEditorCommand | string) => DraftHandleValue;
render(): JSX.Element | null;
}
declare const _default: typeof PrismaEditor;
export default _default;