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, style: style_string(options, :padding), 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