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.0.0.pre.alpha.PLAY14733479 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.0.0.pre.alpha.PLAY14733479 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.0.0.pre.alpha.dependabotnpmandyarnreactjoyride2823478 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.0.0.pre.alpha.dependabotnpmandyarnreactjoyride2823478 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.0.0.pre.alpha.PLAY14113475 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.0.0.pre.alpha.PLAY14113475 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.0.0.pre.alpha.play1447alphatest3462 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.0.0.pre.alpha.play1447alphatest3462 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-14.1.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-14.1.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.play1447addrequiredicons3455 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.play1447addrequiredicons3455 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.play1447addrequiredicons3451 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.play1447addrequiredicons3451 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.PLAY14043436 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.PLAY14043436 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.pbntr258paginationkitforreact3413 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3413 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui_docs-13.34.1.pre.alpha.pbntr258paginationkitforreact3411 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3411 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx