lib/storyblok/richtext/html_renderer/marks/link.rb in storyblok-richtext-renderer-0.0.6 vs lib/storyblok/richtext/html_renderer/marks/link.rb in storyblok-richtext-renderer-0.0.7
- old
+ new
@@ -9,14 +9,27 @@
def tag
attrs = @node['attrs']
if attrs['anchor'].is_a?(String) and !attrs['anchor'].empty?
attrs['href'] = "#{attrs['href']}##{attrs['anchor']}"
+ attrs.delete('anchor')
end
+ if attrs['linktype'].is_a?(String) and attrs['linktype'] == 'email'
+ emailContainer = attrs['href']
+ attrs['href'] = "mailto:#{emailContainer}"
+ end
+
+ if attrs['custom']
+ for item in attrs['custom'] do
+ attrs[item[0]] = item[1]
+ end
+ attrs.delete('custom')
+ end
+
[{
tag: "a",
- attrs: attrs.slice('href', 'target')
+ attrs: attrs
}]
end
end
end
end