方法
- A
- F
- N
- T
常量
ATTRIBUTES | = | %w( sgid contentType url href filename filesize width height previewable content ) + COMPOSED_ATTRIBUTES |
ATTRIBUTE_TYPES | = | { "previewable" => ->(value) { value.to_s == "true" }, "filesize" => ->(value) { Integer(value.to_s, exception: false) || value }, "width" => ->(value) { Integer(value.to_s, exception: false) }, "height" => ->(value) { Integer(value.to_s, exception: false) }, :default => ->(value) { value.to_s } } |
COMPOSED_ATTRIBUTES | = | %w( caption presentation ) |
SELECTOR | = | "[data-trix-attachment]" |
TAG_NAME | = | "figure" |
属性
[R] | node |
类公共方法
from_attributes(attributes) 链接
源代码: 显示 | 在 GitHub 上查看
# File actiontext/lib/action_text/trix_attachment.rb, line 21 def from_attributes(attributes) attributes = process_attributes(attributes) trix_attachment_attributes = attributes.except(*COMPOSED_ATTRIBUTES) trix_attributes = attributes.slice(*COMPOSED_ATTRIBUTES) node = ActionText::HtmlConversion.create_element(TAG_NAME) node["data-trix-attachment"] = JSON.generate(trix_attachment_attributes) node["data-trix-attributes"] = JSON.generate(trix_attributes) if trix_attributes.any? new(node) end
new(node) 链接
源代码: 显示 | 在 GitHub 上查看
# File actiontext/lib/action_text/trix_attachment.rb, line 53 def initialize(node) @node = node end
实例公共方法
attributes() 链接
源代码: 显示 | 在 GitHub 上查看
# File actiontext/lib/action_text/trix_attachment.rb, line 57 def attributes @attributes ||= attachment_attributes.merge(composed_attributes).slice(*ATTRIBUTES) end
to_html() 链接
源代码: 显示 | 在 GitHub 上查看
# File actiontext/lib/action_text/trix_attachment.rb, line 61 def to_html ActionText::HtmlConversion.node_to_html(node) end
to_s() 链接
源代码: 显示 | 在 GitHub 上查看
# File actiontext/lib/action_text/trix_attachment.rb, line 65 def to_s to_html end