UNPKG

2.24 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 private get view();
53 componentDidUpdate(prevProps: Partial<IAllProps>): void;
54 componentDidMount(): void;
55 componentWillUnmount(): void;
56 render(): React.ReactElement<{
57 ref: React.RefObject<HTMLElement>;
58 id: string;
59 }, string | React.JSXElementConstructor<any>>;
60 private changeEvents;
61 private beforeInputEvent;
62 private renderInline;
63 private renderIframe;
64 private getScriptSrc;
65 private getInitialValue;
66 private bindHandlers;
67 private rollbackChange;
68 private handleBeforeInput;
69 private handleBeforeInputSpecial;
70 private handleEditorChange;
71 private handleEditorChangeSpecial;
72 private initialise;
73}
74export {};