Sha256: 74a61ee8094008df814aacbbbf41088feafce5d8b8896c5b80d5579702989e55

Contents?: true

Size: 1.08 KB

Versions: 948

Compression:

Stored size: 1.08 KB

Contents

import React, { useState } from 'react'
import {
  Button,
  Card,
  RichTextEditor,
} from 'playbook-ui'

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}
      />
      {showPreview && (
        <Card marginTop="md">
          <div
              className="trix-content"
              // eslint-disable-next-line react/no-danger
              dangerouslySetInnerHTML={{ __html: previewText }}
              id="preview-content"
          />
        </Card>
      )}
      {!showPreview && (
        <div />
      )}
      <Button
          id="preview-button"
          marginTop="md"
          onClick={handleClick}
          text="Preview Output"
          variant="secondary"
      />
    </div>
  )
}
export default RichTextEditorPreview

Version data entries

948 entries across 948 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx