Module: CKEditor5::Rails::Editor::Helpers
- Included in:
- Helpers
- Defined in:
- lib/ckeditor5/rails/editor/helpers.rb
Defined Under Namespace
Classes: EditorContextError, InvalidEditableHeightError, PresetNotFoundError
Instance Method Summary collapse
- #ckeditor5_editable(name = nil, **kwargs, &block) ⇒ Object
-
#ckeditor5_editor(config: nil, extra_config: {}, type: nil, preset: nil, initial_data: nil, watchdog: true, editable_height: nil, **html_attributes, &block) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #ckeditor5_menubar(**kwargs) ⇒ Object
- #ckeditor5_toolbar(**kwargs) ⇒ Object
- #ckeditor5_ui_part(name, **kwargs, &block) ⇒ Object
Instance Method Details
#ckeditor5_editable(name = nil, **kwargs, &block) ⇒ Object
41 42 43 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 41 def ckeditor5_editable(name = nil, **kwargs, &block) tag.send(:'ckeditor-editable-component', name: name, **kwargs, &block) end |
#ckeditor5_editor(config: nil, extra_config: {}, type: nil, preset: nil, initial_data: nil, watchdog: true, editable_height: nil, **html_attributes, &block) ⇒ Object
rubocop:disable Metrics/ParameterLists
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 13 def ckeditor5_editor( # rubocop:disable Metrics/ParameterLists config: nil, extra_config: {}, type: nil, preset: nil, initial_data: nil, watchdog: true, editable_height: nil, **html_attributes, &block ) validate_editor_input!(initial_data, block) controller_context = validate_and_get_editor_context! preset = resolve_editor_preset(preset || controller_context[:preset]) config = build_editor_config(preset, config, extra_config, initial_data) type ||= preset.type validated_height = validate_editable_height(type, editable_height) || preset.editable_height editor_props = Editor::Props.new( controller_context, type, config, watchdog: watchdog ) render_editor_component( editor_props, html_attributes.merge(validated_height ? { 'editable-height' => validated_height } : {}), &block ) end |
#ckeditor5_menubar(**kwargs) ⇒ Object
53 54 55 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 53 def (**kwargs) ckeditor5_ui_part('menuBarView', **kwargs) end |
#ckeditor5_toolbar(**kwargs) ⇒ Object
49 50 51 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 49 def (**kwargs) ckeditor5_ui_part('toolbar', **kwargs) end |
#ckeditor5_ui_part(name, **kwargs, &block) ⇒ Object
45 46 47 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 45 def ckeditor5_ui_part(name, **kwargs, &block) tag.send(:'ckeditor-ui-part-component', name: name, **kwargs, &block) end |