Sha256: 6447175849105bbda9f3eea3c635a5fc0d7b7c3b353f0e9df9ed9862ff6253a3
Contents?: true
Size: 806 Bytes
Versions: 3
Compression:
Stored size: 806 Bytes
Contents
module Storyblok::Richtext module Marks class Link < Mark def matching @node['type'] === 'link' end 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'].is_a?(Hash) for item in attrs['custom'] do attrs[item[0]] = item[1] end attrs.delete('custom') end [{ tag: "a", attrs: attrs }] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems