Sha256: eccc590bf8f74da85bce77f8bba4fcc63fff52063a3e8d8fb30b1a316c935db9

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module Plutonium
  module UI
    module Form
      module Components
        class Easymde < Phlexi::Form::Components::Base
          include Phlexi::Form::Components::Concerns::HandlesInput

          def view_template
            textarea(**attributes, data_controller: "easymde") { normalize_value(field.value) }
          end

          private

          def normalize_value(value)
            if value.respond_to?(:to_plain_text)
              value.to_plain_text
            else
              value.to_s
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plutonium-0.16.3 lib/plutonium/ui/form/components/easymde.rb
plutonium-0.16.1 lib/plutonium/ui/form/components/easymde.rb
plutonium-0.16.0 lib/plutonium/ui/form/components/easymde.rb
plutonium-0.15.24 lib/plutonium/ui/form/components/easymde.rb