Sha256: 8503b6d86bc2e4300b35b0257ec9f5b48a09e8431f47e87d69c77376de60d542

Contents?: true

Size: 1.08 KB

Versions: 13

Compression:

Stored size: 1.08 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"

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

  # overridden by mods that provide rich text editors
  def rich_text_input
    default_editor = Cardio.config.rich_text_editor || :tinymce
    send "#{default_editor}_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
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-1.96.8 mod/standard/set/all/rich_html/editor.rb
card-1.96.7 mod/standard/set/all/rich_html/editor.rb
card-1.96.6 mod/standard/set/all/rich_html/editor.rb
card-1.96.5 mod/standard/set/all/rich_html/editor.rb
card-1.96.4 mod/standard/set/all/rich_html/editor.rb
card-1.96.3 mod/standard/set/all/rich_html/editor.rb
card-1.96.2 mod/standard/set/all/rich_html/editor.rb
card-1.96.1 mod/standard/set/all/rich_html/editor.rb
card-1.96.0 mod/standard/set/all/rich_html/editor.rb
card-1.95.3 mod/standard/set/all/rich_html/editor.rb
card-1.95.2 mod/standard/set/all/rich_html/editor.rb
card-1.95.1 mod/standard/set/all/rich_html/editor.rb
card-1.95.0 mod/standard/set/all/rich_html/editor.rb