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-10.13.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx