Sha256: 502b874a9b9f7352c3a008b5f48f464d207e30478533d79f0664cad236619e6e

Contents?: true

Size: 1.35 KB

Versions: 469

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

469 entries across 469 versions & 2 rubygems

Version Path
playbook_ui_docs-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui_docs-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
playbook_ui-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb