Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

769 B
Raw Blame
# frozen_string_literal: true

module Primer
  module OpenProject
    module Forms
      # :nodoc:
      class RichTextArea < Primer::Forms::BaseComponent
        include AngularHelper

        delegate :builder, :form, to: :@input

        def initialize(input:, rich_text_options:)
          super()
          @input = input
          @rich_text_data = rich_text_options.delete(:data) { {} }
          @rich_text_data[:"test-selector"] ||= "augmented-text-area-#{@input.name}"
          @rich_text_options = rich_text_options
          @text_area_id =
            if @input.id
              [builder.options[:namespace], @input.id].compact.join("_")
            else
              builder.field_id(@input.name)
            end
        end
      end
    end
  end
end