aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_text
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_text')
-rw-r--r--lib/action_text/attachment.rb2
-rw-r--r--lib/action_text/trix_attachment.rb7
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/action_text/attachment.rb b/lib/action_text/attachment.rb
index a0e0c2f396..cba421c143 100644
--- a/lib/action_text/attachment.rb
+++ b/lib/action_text/attachment.rb
@@ -4,7 +4,7 @@ module ActionText
TAG_NAME = "action-text-attachment"
SELECTOR = TAG_NAME
- ATTRIBUTES = %w( sgid content-type url href filename filesize width height previewable caption )
+ ATTRIBUTES = %w( sgid content-type url href filename filesize width height previewable presentation caption )
class << self
def fragment_by_canonicalizing_attachments(content)
diff --git a/lib/action_text/trix_attachment.rb b/lib/action_text/trix_attachment.rb
index 717d130d12..0c4a3869d8 100644
--- a/lib/action_text/trix_attachment.rb
+++ b/lib/action_text/trix_attachment.rb
@@ -3,7 +3,8 @@ module ActionText
TAG_NAME = "figure"
SELECTOR = "[data-trix-attachment]"
- ATTRIBUTES = %w( sgid contentType url href filename filesize width height previewable content caption )
+ COMPOSED_ATTRIBUTES = %w( caption presentation )
+ 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) rescue value },
@@ -16,8 +17,8 @@ module ActionText
def from_attributes(attributes)
attributes = process_attributes(attributes)
- trix_attachment_attributes = attributes.except("caption")
- trix_attributes = attributes.slice("caption")
+ 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)