diff --git a/src/components/editor/Editor.d.ts b/src/components/editor/Editor.d.ts index a473cfcaf5..2b8fe24842 100644 --- a/src/components/editor/Editor.d.ts +++ b/src/components/editor/Editor.d.ts @@ -11,7 +11,8 @@ interface EditorProps { formats?: any[]; headerTemplate?: JSX.Element | undefined, onTextChange?(e: { htmlValue: string|null, textValue: string, delta: any, source: string }): void; - onSelectionChange?(e: { range: any, oldRange: any, source: string }): void; + onSelectionChange?(e: { range: any, oldRange: any, source: string }): void; + theme?: string; } export class Editor extends React.Component { diff --git a/src/components/editor/Editor.js b/src/components/editor/Editor.js index cf44f864e9..dd12f95c64 100644 --- a/src/components/editor/Editor.js +++ b/src/components/editor/Editor.js @@ -18,7 +18,8 @@ export class Editor extends Component { formats: null, headerTemplate: null, onTextChange: null, - onSelectionChange: null + onSelectionChange: null, + theme: 'snow' }; static propTypes = { @@ -32,7 +33,8 @@ export class Editor extends Component { formats: PropTypes.array, headerTemplate: PropTypes.any, onTextChange: PropTypes.func, - onSelectionChange: PropTypes.func + onSelectionChange: PropTypes.func, + theme: PropTypes.oneOf(['snow', 'bubble']) }; componentDidMount() { @@ -43,7 +45,7 @@ export class Editor extends Component { }, placeholder: this.props.placeholder, readOnly: this.props.readOnly, - theme: 'snow', + theme: this.props.theme, formats: this.props.formats }); @@ -91,7 +93,7 @@ export class Editor extends Component { render() { let containerClass = classNames('p-component p-editor-container', this.props.className); let toolbarHeader = null; - + if (this.props.headerTemplate) { toolbarHeader = (
this.toolbarElement = el} className="p-editor-toolbar">