Sha256: bde1f121b3517825ffa58368a04429396968f3dc8ef242ff9d56da89cca27a16

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

include_set Abstract::ProsemirrorEditor
include_set Abstract::TinymceEditor
include_set Abstract::AceEditor

Self::InputOptions.add_to_basket :options, "text area"
Self::InputOptions.add_to_basket :options, "text field"
Self::InputOptions.add_to_basket :options, "calendar"

format :html do
  def editor
    (c = card.rule(:input)) && c.gsub(/[\[\]]/, "").tr(" ", "_")
  end

  def editor_method editor_type
    "#{editor_type}_input"
  end

  def editor_defined_by_card
    return unless (editor_card = Card[editor])
    nest editor_card, view: :core
  end

  view :editor do
    try(editor_method(editor)) ||
      editor_defined_by_card ||
      send(editor_method(default_editor))
  end

  def default_editor
    :rich_text
  end

  # overriden by mods that provide rich text editors
  def rich_text_input
    prosemirror_editor_input
  end

  def text_area_input
    text_area :content, rows: 5, class: "d0-card-content",
                        "data-card-type-code" => card.type_code
  end

  def text_field_input
    text_field :content, class: "d0-card-content"
  end

  def calendar_input
    text_field :content, class: "date-editor"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
card-1.92.2 mod/standard/set/all/rich_html/editor.rb
card-1.92.1 mod/standard/set/all/rich_html/editor.rb
card-1.92 mod/standard/set/all/rich_html/editor.rb
card-1.91 mod/standard/set/all/rich_html/editor.rb