Module: CKEditor5::Rails::Editor::Helpers::Config

Included in:
Editor, Helpers, Presets::PresetBuilder
Defined in:
lib/ckeditor5/rails/editor/helpers/config_helpers.rb

Instance Method Summary collapse

Instance Method Details

#ckeditor5_element_ref(selector) ⇒ Object



5
6
7
# File 'lib/ckeditor5/rails/editor/helpers/config_helpers.rb', line 5

def ckeditor5_element_ref(selector)
  { '$element': selector }
end

#ckeditor5_preset(name = nil, &block) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
# File 'lib/ckeditor5/rails/editor/helpers/config_helpers.rb', line 9

def ckeditor5_preset(name = nil, &block)
  return CKEditor5::Rails::Engine.find_preset(name) if name

  raise ArgumentError, 'Configuration block is required for preset definition' unless block_given?

  CKEditor5::Rails::Presets::PresetBuilder.new(&block)
end