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_docs-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.33.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx