Sha256: 9f962aa6f2cfd00fbe17aa96d9729b166fb849192c34baf52ef42202c60bb183

Contents?: true

Size: 1.07 KB

Versions: 1024

Compression:

Stored size: 1.07 KB

Contents

import React, { useState } from 'react'
import {
  Button,
  Card,
  RichTextEditor,
} from '../../'

const RichTextEditorPreview = (props) => {
  const [showPreview, setShowPreview] = useState(false)
  const [previewText, setPreviewText] = useState(<div />)

  const handleChange = (event) => setPreviewText(event)
  const handleClick = () => {
    setShowPreview(true)
  }

  return (
    <div>
      <RichTextEditor
          id="content-preview-editor"
          onChange={handleChange}
          {...props}
      />
      <If condition={showPreview}>
        <Card marginTop="md">
          <div
              className="trix-content"
              // eslint-disable-next-line react/no-danger
              dangerouslySetInnerHTML={{ __html: previewText }}
              id="preview-content"
          />
        </Card>
        <Else />
        <div />
      </If>
      <Button
          id="preview-button"
          marginTop="md"
          onClick={handleClick}
          text="Preview Output"
          variant="secondary"
      />
    </div>
  )
}
export default RichTextEditorPreview

Version data entries

1,024 entries across 1,024 versions & 2 rubygems

Version Path
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.14.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.13.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.12.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.11.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.10.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.10.0.pre.alpha2 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.10.0.pre.alpha1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.9.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.8.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.7.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx