Sha256: 15338e15add88833aca4dd10cbc551b4a92cd04fc7b837d4d6d273ae044b378a

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

module Maglove
  module Widgets
    class Paragraph < Base
      def identifier
        "paragraph"
      end

      def defaults
        {
          style: "default",
          align: "left",
          size: "md",
          drop_cap: "",
          drop_cap_color: "#000000",
          line_height: ""
        }
      end

      def template(&block)
        scope.haml_tag :div, class: "paragraph #{options[:style]} align-#{options[:align]} size-#{options[:size]}" do
          unless options[:drop_cap].empty?
            haml_tag :span, class: "__dropcap", style: "color: #{options[:drop_cap_color]};" do
              haml_concat(options[:drop_cap])
            end
          end
          haml_tag :span, contenteditable: true, class: "paragraph-content", style: style_string(options, :line_height) do
            yield if block
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maglove-widgets-2.0.3 lib/maglove/widgets/paragraph.rb