Sha256: 502b874a9b9f7352c3a008b5f48f464d207e30478533d79f0664cad236619e6e

Contents?: true

Size: 1.35 KB

Versions: 475

Compression:

Stored size: 1.35 KB

Contents

<%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
<div id="card-obfuscation" style="display:none">
  <%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
   <div id="content-preview" class="trix-content">
   </div>
  <% end %>
</div>
<%= pb_rails("button", props: { id: "preview-button", variant: "secondary", margin_top: "md" }) do %>
  <span>Preview Output</span>
<% end %>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    function handleButtonClick() {
      const editorContainer = [...document.querySelectorAll('[data-react-props]')]
        .find(element => element.getAttribute('data-react-props')?.includes('"id":"content-preview-editor"'))

      const editorElement = editorContainer?.querySelector('trix-editor')
      const inputId = editorElement?.getAttribute('input')
      const inputElement = inputId && document.getElementById(inputId)
      
      const editorContent = inputElement?.value || '' 
      const previewArea = document.getElementById('content-preview')
      const cardDiv = document.getElementById('card-obfuscation')

      if (previewArea && cardDiv) {
        previewArea.innerHTML = editorContent 
        cardDiv.style.display = 'block'
      }
    }

    document.getElementById('preview-button')?.addEventListener('click', handleButtonClick)
  })
</script>

Version data entries

475 entries across 475 versions & 2 rubygems

Version Path
playbook_ui_docs-14.7.0.pre.rc.7 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.7.0.pre.rc.7 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4312 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4312 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4305 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4305 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.7.0.pre.rc.6 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.7.0.pre.rc.6 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4304 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4304 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4303 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4303 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PLAY1550lazysizesupgrade4295 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PLAY1550lazysizesupgrade4295 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4274 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4274 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.6.2.pre.alpha.PLAY1607dependencydisplayymlupdate4271 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.6.2.pre.alpha.PLAY1607dependencydisplayymlupdate4271 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb