Sha256: 4f6e94552a8812f023e767e1c77e4ba3fb776d3eb998e8292030a349860b1065

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

module Plutonium
  module UI
    module Form
      module Components
        class EasymdeInput < 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

1 entries across 1 versions & 1 rubygems

Version Path
plutonium-0.15.23 lib/plutonium/ui/form/components/easymde_input.rb