renderField()

in public/video-ui/src/components/FormFields/RichTextField.tsx [93:138]


  renderField() {
    const requiresValidation = this.state.wordCount === 0  && this.props.fieldLocation === 'trailText';
    const hasWarning = requiresValidation && this.props.isDesired;
    const hasError = requiresValidation && this.props.isRequired;
    if (!this.props.editable) {
      if (this.state.wordCount === 0) {
        return (
          <div className="details-list__field details-list__empty">
            {this.props.placeholder}
          </div>
        );
      }
      return (
        <div
          className="details-list__field details-list__field-with-content"
          dangerouslySetInnerHTML={{ __html: this.props.fieldValue }}
        />
      );
    }

    return (
      <div>
        <div
          className={'form__row editor__row'}
        >
          <RichTextEditor
            value={this.props.fieldValue}
            onUpdate={this.updateFieldValue}
            config={this.props.config}
            shouldAcceptCopiedText={!!this.props.derivedFrom}
          />
          {this.renderLimitWarning()}
        </div>
        {hasWarning
          ? <p className="form__message form__message--warning">
            {RequiredForComposer.warning}
            </p>
          : ''}
        {hasError
          ? <p className="form__message form__message--error">
            {RequiredForComposer.error}
            </p>
          : ''}
      </div>
    );
  }