Class: Forms::RichTextarea
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- Forms::RichTextarea
- Defined in:
- lib/forms/rich_textarea.rb
Overview
A rich-text editor backed by the Lexxy <lexxy-editor> custom element for
ActionText. Optional feature: requires ActionText/Lexxy in the host app.
Renders an editor bound to the field; when the value is an ActionText::RichText
its HTML body is used as the initial content.
Instance Method Summary collapse
-
#initialize(*modifiers, name:, id: nil, value: nil, **options) ⇒ RichTextarea
constructor
A new instance of RichTextarea.
- #view_template ⇒ Object
Constructor Details
#initialize(*modifiers, name:, id: nil, value: nil, **options) ⇒ RichTextarea
Returns a new instance of RichTextarea.
11 12 13 14 15 16 17 18 |
# File 'lib/forms/rich_textarea.rb', line 11 def initialize(*modifiers, name:, id: nil, value: nil, **) @modifiers = modifiers @name = name @id = id || name.to_s.gsub(/[\[\]]/, "_").gsub(/_+$/, "") @value = value @options = super() end |
Instance Method Details
#view_template ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/forms/rich_textarea.rb', line 20 def view_template lexxy_editor( name: @name, id: @id, value: formatted_value, class: editor_classes, **@options.except(:class, :error) ) end |