Skip to content

Commit

Permalink
Merge pull request #912 from customd/feature/quill_theme
Browse files Browse the repository at this point in the history
Fixed #938 - Allow switching between snow & Bubble toolbar theme
  • Loading branch information
mertsincan authored Jun 21, 2019
2 parents d70d0bf + 7d9bc65 commit db8f85b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/editor/Editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EditorProps, any> {
Expand Down
10 changes: 6 additions & 4 deletions src/components/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class Editor extends Component {
formats: null,
headerTemplate: null,
onTextChange: null,
onSelectionChange: null
onSelectionChange: null,
theme: 'snow'
};

static propTypes = {
Expand All @@ -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() {
Expand All @@ -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
});

Expand Down Expand Up @@ -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 = (
<div ref={(el) => this.toolbarElement = el} className="p-editor-toolbar">
Expand Down

0 comments on commit db8f85b

Please sign in to comment.