Skip to content

Commit

Permalink
Fixed #904 - Modules property for Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed May 30, 2019
1 parent 75e56a3 commit c24fdff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/components/editor/Editor.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import * as React from 'react';

interface EditorProps {
id?: string,
value?: string,
style?: object,
className?: string,
placeholder?: string,
readonly?: boolean,
formats?: any[],
id?: string;
value?: string;
style?: object;
className?: string;
placeholder?: string;
readonly?: boolean;
modules?: any;
formats?: any[];
headerTemplate?: JSX.Element | undefined,
onTextChange?(e: { htmlValue: string|null, textValue: string, delta: any, source: string }): void,
onTextChange?(e: { htmlValue: string|null, textValue: string, delta: any, source: string }): void;
onSelectionChange?(e: { range: any, oldRange: any, source: string }): void;
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class Editor extends Component {
className: null,
placeholder: null,
readOnly: false,
modules: null,
formats: null,
headerTemplate: null,
onTextChange: null,
Expand All @@ -27,6 +28,7 @@ export class Editor extends Component {
className: PropTypes.string,
placeholder: PropTypes.string,
readOnly: PropTypes.bool,
modules: PropTypes.object,
formats: PropTypes.array,
headerTemplate: PropTypes.any,
onTextChange: PropTypes.func,
Expand All @@ -36,7 +38,8 @@ export class Editor extends Component {
componentDidMount() {
this.quill = new Quill(this.editorElement, {
modules: {
toolbar: this.toolbarElement
toolbar: this.toolbarElement,
...this.props.modules
},
placeholder: this.props.placeholder,
readOnly: this.props.readOnly,
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/editor/EditorDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ const header = (
<td>false</td>
<td>Whether to instantiate the editor to read-only mode.</td>
</tr>
<tr>
<td>modules</td>
<td>object</td>
<td>null</td>
<td>Modules configuration, see <a href="http://quilljs.com/docs/modules/">here</a> for available options.</td>
</tr>
<tr>
<td>formats</td>
<td>string[]</td>
Expand Down

0 comments on commit c24fdff

Please sign in to comment.