Skip to content

Commit b8cb07c

Browse files
Merge pull request #1773 from HarminderSethi/dev
Added style property to Rich text control.
2 parents 4cbc6ea + 9e65307 commit b8cb07c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

docs/documentation/docs/controls/RichText.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The RichText control can be configured with the following properties:
7070
| id | string | no | The ID to apply to the RichText control. |
7171
| label | string | no | The label displayed above the RichText control. |
7272
| className | string | no | The custom CSS class to apply to the RichText control. |
73+
| style | React.CSSProperties | no | The custom styles to apply to the RichText control. |
7374
| isEditMode | boolean | no | `true` indicates that users will be able to edit the content of the RichText control. `false` will display the rich text as read-only. |
7475
| styleOptions | StyleOptions | no | Define the styles you want to show or hide for the rich text editor |
7576
| value | string | no | Sets the rich text to display in the RichText control. |

src/controls/richText/RichText.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ export class RichText extends React.Component<IRichTextProps, IRichTextState> {
467467
}
468468

469469
// Okay, we're in edit mode.
470-
const { placeholder, styleOptions: { showStyles, showBold, showItalic, showUnderline, showAlign, showList, showLink, showMore, showImage } } = this.props;
470+
const { placeholder,style, styleOptions: { showStyles, showBold, showItalic, showUnderline, showAlign, showList, showLink, showMore, showImage } } = this.props;
471471

472472
// Get a unique id for the toolbar
473473
const modules = {
@@ -516,7 +516,7 @@ export class RichText extends React.Component<IRichTextProps, IRichTextState> {
516516
ReactQuillInstance.register(sizeClass, true);
517517

518518
return (
519-
<div ref={(ref) => { this._wrapperRef = ref; }} className={css(styles.richtext && this.state.editing ? 'ql-active' : null, this.props.className || null) || null}>
519+
<div ref={(ref) => { this._wrapperRef = ref; }} className={css(styles.richtext && this.state.editing ? 'ql-active' : null, this.props.className || null) || null} style={style}>
520520
{renderLabel}
521521
<div id={this._toolbarId} style={{ top: this.state.wrapperTop }}>
522522
{

src/controls/richText/RichText.types.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { ISwatchColor } from './SwatchColorPickerGroup.types';
23
export interface IRichTextProps {
34
/**
@@ -18,6 +19,12 @@ export interface IRichTextProps {
1819
*/
1920
className?: string;
2021

22+
/**
23+
* Styles to apply to the rich text editor.
24+
* @defaultvalue null
25+
*/
26+
style?: React.CSSProperties;
27+
2128
/**
2229
* Indicates if the rich text editor should be in edit mode
2330
* @defaultvalue true
@@ -28,7 +35,7 @@ export interface IRichTextProps {
2835
* Placeholder text to show when editor is empty.
2936
* @defaultvalue undefined
3037
*/
31-
placeholder? : string;
38+
placeholder?: string;
3239

3340
/**
3441
* The HTML text containing the rich text

0 commit comments

Comments
 (0)