Sha256: f421cccd242990ea1a8cc69ecab77edea674a5860e30b6cd7a1f16212d2d54f2

Contents?: true

Size: 523 Bytes

Versions: 11

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

module EditorJs
  module Blocks
    class CodeBlock < Base
      def schema
        YAML.safe_load(<<~YAML)
          type: object
          additionalProperties: false
          properties:
            code:
              type: string
          required:
          - code
        YAML
      end

      def render(_options = {})
        content_tag :code, class: css_name do
          data['code']
        end
      end

      def plain
        data['code'].strip
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
editor_js-0.3.3 lib/editor_js/blocks/code_block.rb
editor_js-0.3.2 lib/editor_js/blocks/code_block.rb
editor_js-0.3.1 lib/editor_js/blocks/code_block.rb
editor_js-0.3.0 lib/editor_js/blocks/code_block.rb
editor_js-0.2.5 lib/editor_js/blocks/code_block.rb
editor_js-0.2.4 lib/editor_js/blocks/code_block.rb
editor_js-0.2.3 lib/editor_js/blocks/code_block.rb
editor_js-0.2.2 lib/editor_js/blocks/code_block.rb
editor_js-0.2.1 lib/editor_js/blocks/code_block.rb
editor_js-0.2.0 lib/editor_js/blocks/code_block.rb
editor_js-0.1.0 lib/editor_js/blocks/code_block.rb