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
-
#ckeditor5_element_ref(selector) ⇒ Hash
Creates a reference to a DOM element that will be used by CKEditor’s features.
-
#ckeditor5_preset(name = nil) { ... } ⇒ PresetBuilder
Creates or retrieves a preset configuration for CKEditor.
Instance Method Details
#ckeditor5_element_ref(selector) ⇒ Hash
Creates a reference to a DOM element that will be used by CKEditor’s features. This is particularly useful for features that need to check element presence or operate on specific DOM elements.
16 17 18 |
# File 'lib/ckeditor5/rails/editor/helpers/config_helpers.rb', line 16 def ckeditor5_element_ref(selector) { '$element': selector } end |
#ckeditor5_preset(name = nil) { ... } ⇒ PresetBuilder
Creates or retrieves a preset configuration for CKEditor. When called with a name, finds and returns an existing preset. When called with a block, creates a new preset with the given configuration.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ckeditor5/rails/editor/helpers/config_helpers.rb', line 48 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( disallow_inline_plugins: true, &block ) end |