ActionText Blob部分不呈现额外元素

我正在使用actionText渲染一些RTF文本,并且由于某些原因,我在使用actionText提供的partial将额外的元素添加到渲染的part中有限制

我需要将附加的图像包裹在表格元素周围,以便可以在Outlook中为电子邮件正确呈现它们。 actionText似乎总是忽略我在这部分内容中添加的任何额外元素。有人知道为什么会发生这种情况以及是否有解决此问题的方法吗?

这是我的部分,其中表元素被忽略:

/views/active_storage/blobs/_blob.html.erb

<table>
  <Tr>
    <td>
      <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %> text-center">
        <% if blob.representable? %>
          <%= image_tag rails_representation_url(blob.representation(resize_to_limit: [600,400])) %>

          <% if caption = blob.try(:caption) %>
            <figcaption class="attachment__caption text-center">
              <%= caption %>
            </figcaption>
          <% end %>
        <% end %>
      </figure>
    </td>
  </Tr>
</table>
a692613576 回答:ActionText Blob部分不呈现额外元素

对于我来说,当我在_blob.html.erb中将自定义属性(data-)添加到link_to帮助器时,它不包含在呈现的链接标记中。

<% if blob.representable? %>
  <%= link_to image_tag(blob.representation(resize_to_limit: 
local_assigns[:in_gallery] ? [ 800,600 ] : [ 1024,768 ]),class: 'rounded'),rails_blob_path(blob),{ 'data-fancybox': 'gallery' } %>
<% end %>
,

我发现问题与动作文本有关,该动作文本使用内部方法在渲染之前清理字符串。

我在初始化程序中覆盖了允许的属性和标签:

x = df_diabetes_normalizado['Glicose']
y = df_diabetes_normalizado['Massa Corporal']
Cluster = df_diabetes_normalizado['clusters']
centers = np.random.randn(1,2) 

fig = plt.figure(figsize=(14,9))
ax = fig.add_subplot(111)
scatter = ax.scatter(x,y,c=Cluster,s=50)
for i,j in centers:
    ax.scatter(i,j,s=50,c='red',marker='+')
ax.set_xlabel('x')
ax.set_ylabel('y')

fig.show()
,

我想知道如何在_blob.html.erb文件中获取action_name。 因为我想根据动作名称显示或关闭图像的链接,例如foo(1,add(2,3,4)); ^ show

,
# config/initializers/html_sanitation.rb

Rails::Html::WhiteListSanitizer.allowed_tags << 'h2'
本文链接:https://www.f2er.com/3041268.html

大家都在问