diff --git a/src/controls/richText/RichText.tsx b/src/controls/richText/RichText.tsx index 1b4fef19d..8b05663b3 100644 --- a/src/controls/richText/RichText.tsx +++ b/src/controls/richText/RichText.tsx @@ -107,7 +107,6 @@ export class RichText extends React.Component { constructor(props: IRichTextProps) { super(props); - telemetry.track('ReactRichText', { className: !!props.className }); @@ -579,7 +578,8 @@ id="DropDownStyles" editor={this.getEditor()} isOpen={this.state.morePaneVisible} onClose={this.handleClosePanel} - onLink={this.showInsertLinkDialog} /> + onLink={this.showInsertLinkDialog} + customColors={this.props.customColors}/> { this.renderLinkDialog() diff --git a/src/controls/richText/RichText.types.ts b/src/controls/richText/RichText.types.ts index 2cff70581..9eb254c0e 100644 --- a/src/controls/richText/RichText.types.ts +++ b/src/controls/richText/RichText.types.ts @@ -1,3 +1,4 @@ +import { ISwatchColor } from './SwatchColorPickerGroup.types'; export interface IRichTextProps { /** * CSS class to apply to the rich text editor. @@ -27,6 +28,11 @@ export interface IRichTextProps { */ styleOptions?: StyleOptions; + /** + * Additional colors to include in swatch + */ + customColors?: ISwatchColor[]; + /** * Callback issued when the rich text changes. * Returns the text that will be inserted in the rich text control. diff --git a/src/controls/richText/RichTextPropertyPane.tsx b/src/controls/richText/RichTextPropertyPane.tsx index ba1380713..e42824411 100644 --- a/src/controls/richText/RichTextPropertyPane.tsx +++ b/src/controls/richText/RichTextPropertyPane.tsx @@ -317,14 +317,19 @@ export default class RichTextPropertyPane extends React.Component { const color: string = this.state.formats.color || ThemeColorHelper.GetThemeColor(styles.NeutralPrimary); const backgroundColor: string = this.state.formats.background || "rgba(0, 0, 0, 0)"; + + /** + * Add custom colors if passed as a property + */ + let fontColorGroups = ["themeColors","standardColors"]; + if(this.props.customColors) fontColorGroups.push('customColors'); + return (
- void; onLink: () => void; } diff --git a/src/controls/richText/RteColorPicker.tsx b/src/controls/richText/RteColorPicker.tsx index 93fdb05d6..df936a313 100644 --- a/src/controls/richText/RteColorPicker.tsx +++ b/src/controls/richText/RteColorPicker.tsx @@ -26,7 +26,6 @@ export default class RteColorPicker extends React.Component { const { buttonLabel, defaultButtonLabel, fillThemeColor, id, previewColor } = this.props; - return (
this.wrapperRef = ref}> @@ -36,7 +35,8 @@ export default class RteColorPicker extends React.Component this.handleColorChanged(previewColor)}> - void; + customColors?: ISwatchColor[]; } export interface IRteColorPickerState { diff --git a/src/controls/richText/SwatchColorPickerGroup.tsx b/src/controls/richText/SwatchColorPickerGroup.tsx index 86a790b78..03f6ee132 100644 --- a/src/controls/richText/SwatchColorPickerGroup.tsx +++ b/src/controls/richText/SwatchColorPickerGroup.tsx @@ -9,7 +9,6 @@ import { chunk } from '@microsoft/sp-lodash-subset'; export default class SwatchColorPickerGroup extends React.Component { public render(): React.ReactElement { const colorRows = chunk(this.props.groupColors, 5); - return (