Module: CKEditor5::Rails::Presets::Concerns::ConfigurationMethods

Extended by:
ActiveSupport::Concern
Included in:
Context::PresetBuilder, PresetBuilder
Defined in:
lib/ckeditor5/rails/presets/concerns/configuration_methods.rb

Overview

ConfigurationMethods provides functionality for configuring CKEditor 5 presets and instances.

This module is included in preset builders and allows setting various configuration options for the editor.

Examples:

Basic configuration in preset

presets.define :custom do
  configure :height, '400px'
  configure :width, '600px'
end

Complex configuration with nested options

presets.define :custom do
  configure :image, {
    toolbar: ['imageTextAlternative', 'imageStyle:inline'],
    styles: ['alignLeft', 'alignCenter']
  }
end

Plugin-specific configuration

presets.define :custom do
  configure :heading, {
    options: [
      { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
      { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' }
    ]
  }
end

Instance Method Summary collapse

Instance Method Details

#configure(key, value) ⇒ Object

Sets a configuration value for a given key in the editor configuration.

Examples:

Setting simple configuration

configure :width, '500px'

Setting plugin configuration

configure :toolbar, ['bold', 'italic', '|', 'undo', 'redo']

Setting nested configuration

configure :image, {
  styles: {
    options: ['alignLeft', 'alignCenter']
  }
}

Parameters:

  • key (Symbol, String)

    The configuration key

  • value (Object)

    The configuration value



60
61
62
# File 'lib/ckeditor5/rails/presets/concerns/configuration_methods.rb', line 60

def configure(key, value)
  config[key] = value
end