Module: CKEditor5::Rails::Editor::Helpers
- Included in:
- Helpers
- Defined in:
- lib/ckeditor5/rails/editor/helpers.rb
Defined Under Namespace
Classes: EditorContextError, PresetNotFoundError
Instance Method Summary collapse
- #ckeditor5_editable(name = nil, **kwargs, &block) ⇒ Object
-
#ckeditor5_editor(config: nil, extra_config: {}, type: nil, preset: :default, initial_data: nil, watchdog: true, **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
37 38 39 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 37 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: :default, initial_data: nil, watchdog: true, **html_attributes, &block) ⇒ Object
rubocop:disable Metrics/ParameterLists
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 12 def ckeditor5_editor( # rubocop:disable Metrics/ParameterLists config: nil, extra_config: {}, type: nil, preset: :default, initial_data: nil, watchdog: true, **html_attributes, &block ) controller_context = validate_and_get_editor_context! preset = fetch_editor_preset(preset) config ||= preset.config type ||= preset.type config = config.deep_merge(extra_config) config[:initialData] = initial_data if initial_data raise ArgumentError, 'Cannot pass initial data and block at the same time.' if initial_data && block editor_props = Editor::Props.new( controller_context, type, config, watchdog: watchdog ) render_editor_component(editor_props, html_attributes, &block) end |
#ckeditor5_menubar(**kwargs) ⇒ Object
49 50 51 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 49 def (**kwargs) ckeditor5_ui_part('menuBarView', **kwargs) end |
#ckeditor5_toolbar(**kwargs) ⇒ Object
45 46 47 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 45 def (**kwargs) ckeditor5_ui_part('toolbar', **kwargs) end |
#ckeditor5_ui_part(name, **kwargs, &block) ⇒ Object
41 42 43 |
# File 'lib/ckeditor5/rails/editor/helpers.rb', line 41 def ckeditor5_ui_part(name, **kwargs, &block) tag.send(:'ckeditor-ui-part-component', name: name, **kwargs, &block) end |