Sha256: 876bac27043de72c26294e926d7c571c99bcd8eade1c40ea3ae6d938ca04a0a1
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
# frozen_string_literal: true module EditorJs module Blocks class EmbedBlock < Base def schema YAML.safe_load(<<~YAML) type: object additionalProperties: false properties: caption: type: string embed: type: string height: type: - number - string service: type: string source: type: string width: type: - number - string required: - embed - service - source - width - height YAML end def render(options = {}) content_tag :div, class: css_name do concat content_tag(:iframe, '', src: data['embed'], width: data['width'], height: data['height'], frameborder: options.fetch('frameborder', '0'), allowfullscreen: options.fetch('allowfullscreen', true)) concat content_tag(:span, data['caption']) end end def sanitize %w(caption embed height service source width).each do |key| data[key] = Sanitize.fragment(data[key], remove_contents: true).strip end end def plain data['caption'].strip end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
editor_js-0.1.0 | lib/editor_js/blocks/embed_block.rb |