Актон текст, дисплей видео плеер с активным хранилищем - PullRequest
0 голосов
/ 26 апреля 2020

Я использую редактор Trix с функцией загрузки приложений.

В настоящее время я могу загружать изображения, PDF, видео и т. Д. c ... и показывать их после отправки. Также у меня может быть предварительный просмотр того, что я загрузил.

Но я не знаю, как добавить к нему видеоплеер.

Мой фактический _blob. html .erb выглядит так это:

<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
    <% if blob.representable? %>
    <%= image_tag blob.representation(resize_to_fit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
    <% end %>

    <figcaption class="attachment__caption flex-1">
        <div>
        <% if caption = blob.try(:caption) %>
        <%= caption %>
        <% else %>
        <span class="attachment__name text-gray-600"><%= blob.filename %></span>
        <span class="attachment__size text-gray-600"><%= number_to_human_size blob.byte_size %></span>
        <% end %>
        </div>
         <div class="mt-6 mb-4">
        <%= link_to "View file", rails_blob_url(blob, disposition: "preview"), target: "_blank", class: "bg-gray-200 text-sm py-2 px-4 rounded mt-6" %> -
        <%= link_to "Download", rails_blob_path(blob, disposition: "attachment"), class: " text-sm bg-gray-200 py-2 px-4 rounded" %>
        </div>
    </figcaption>
</figure>
...