UNPKG

2.16 kBTypeScriptView Raw
1/**
2 * Copyright (c) 2017-present, Ephox, Inc.
3 *
4 * This source code is licensed under the Apache 2 license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 */
8import * as React from 'react';
9import { IEvents } from '../Events';
10import { IEditorPropTypes } from './EditorPropTypes';
11import { Editor as TinyMCEEditor, TinyMCE } from 'tinymce';
12declare type EditorOptions = Parameters<TinyMCE['init']>[0];
13export interface IProps {
14 apiKey: string;
15 id: string;
16 inline: boolean;
17 initialValue: string;
18 onEditorChange: (a: string, editor: TinyMCEEditor) => void;
19 value: string;
20 init: EditorOptions & {
21 selector?: undefined;
22 target?: undefined;
23 };
24 tagName: string;
25 cloudChannel: string;
26 plugins: NonNullable<EditorOptions['plugins']>;
27 toolbar: NonNullable<EditorOptions['toolbar']>;
28 disabled: boolean;
29 textareaName: string;
30 tinymceScriptSrc: string;
31 rollback: number | false;
32 scriptLoading: {
33 async?: boolean;
34 defer?: boolean;
35 delay?: number;
36 };
37}
38export interface IAllProps extends Partial<IProps>, Partial<IEvents> {
39}
40export declare class Editor extends React.Component<IAllProps> {
41 static propTypes: IEditorPropTypes;
42 static defaultProps: Partial<IAllProps>;
43 editor?: TinyMCEEditor;
44 private id;
45 private elementRef;
46 private inline;
47 private currentContent?;
48 private boundHandlers;
49 private rollbackTimer;
50 private valueCursor;
51 constructor(props: Partial<IAllProps>);
52 componentDidUpdate(prevProps: Partial<IAllProps>): void;
53 componentDidMount(): void;
54 componentWillUnmount(): void;
55 render(): React.ReactElement<{
56 ref: React.RefObject<HTMLElement>;
57 id: string;
58 }, string | React.JSXElementConstructor<any>>;
59 private renderInline;
60 private renderIframe;
61 private getScriptSrc;
62 private getInitialValue;
63 private bindHandlers;
64 private rollbackChange;
65 private handleBeforeInput;
66 private handleBeforeInputSpecial;
67 private handleEditorChange;
68 private handleEditorChangeSpecial;
69 private initialise;
70}
71export {};