class CKEditor5::Rails::Hooks::SimpleForm::CKEditor5Input

<% end %>
%>
error: ‘Content cannot be blank’
input_html: { style: ‘width: 600px’ },
required: true,
as: :ckeditor5,
<%= f.input :content,
<%= simple_form_for @post do |f| %>
@example With validation and error handling
<% end %>
%>
}
initial_data: ‘Hello!’
class: ‘custom-editor’,
style: ‘width: 600px’,
input_html: {
type: :inline,
preset: :custom,
as: :ckeditor5,
<%= f.input :content,
<%= simple_form_for @post do |f| %>
@example With custom preset and styling
<% end %>
%>
required: true
input_html: { style: ‘width: 600px’ },
as: :ckeditor5,
<%= f.input :content,
<%= simple_form_for @post do |f| %>
@example Basic usage in a form
as a form input with all its features and configurations.
This class enables seamless integration with Simple Form, allowing use of CKEditor 5
Custom input type for Simple Form integration with CKEditor 5.

def editor_options(merged_input_options)

Returns:
  • (Hash) - Options for CKEditor instance

Parameters:
  • merged_input_options (Hash) -- Combined input options
def editor_options(merged_input_options)
  {
    preset: input_options.fetch(:preset, :default),
    type: input_options.fetch(:type, :classic),
    config: input_options[:config],
    initial_data: object.try(attribute_name) || input_options[:initial_data],
    name: "#{object_name}[#{attribute_name}]",
    **merged_input_options
  }
end

def input(wrapper_options = nil)

Returns:
  • (String) - Rendered editor HTML

Parameters:
  • wrapper_options (Hash) -- Options passed from the form wrapper
def input(wrapper_options = nil)
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
  @builder.template.ckeditor5_editor(**editor_options(merged_input_options))
end