Module: CKEditor5::Rails::Editor::Helpers::Editor
- Includes:
- Cdn::Concerns::BundleBuilder, Config
- Included in:
- Helpers
- Defined in:
- lib/ckeditor5/rails/editor/helpers/editor_helpers.rb
Instance Method Summary collapse
-
#ckeditor5_editable(name = nil, **kwargs, &block) ⇒ Object
Creates an editable area for multiroot or decoupled editors.
-
#ckeditor5_editor(preset: nil, config: nil, extra_config: {}, type: nil, initial_data: nil, watchdog: true, editable_height: nil, language: nil, **html_attributes, &block) ⇒ Object
Creates a CKEditor 5 editor instance in the view.
-
#ckeditor5_menubar(**kwargs) ⇒ Object
Creates a menubar component for decoupled editor.
-
#ckeditor5_toolbar(**kwargs) ⇒ Object
Creates a toolbar component for decoupled editor.
-
#ckeditor5_ui_part(name, **kwargs, &block) ⇒ Object
Creates a UI part component for the editor (toolbar, menubar).
Methods included from Cdn::Concerns::BundleBuilder
Methods included from Config
#ckeditor5_element_ref, #ckeditor5_preset
Instance Method Details
#ckeditor5_editable(name = nil, **kwargs, &block) ⇒ Object
Creates an editable area for multiroot or decoupled editors.
98 99 100 |
# File 'lib/ckeditor5/rails/editor/helpers/editor_helpers.rb', line 98 def ckeditor5_editable(name = nil, **kwargs, &block) tag.public_send(:'ckeditor-editable-component', name: name, **kwargs, &block) end |
#ckeditor5_editor(preset: nil, config: nil, extra_config: {}, type: nil, initial_data: nil, watchdog: true, editable_height: nil, language: nil, **html_attributes, &block) ⇒ Object
Creates a CKEditor 5 editor instance in the view.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ckeditor5/rails/editor/helpers/editor_helpers.rb', line 59 def ckeditor5_editor( # rubocop:disable Metrics/ParameterLists preset: nil, config: nil, extra_config: {}, type: nil, initial_data: nil, watchdog: true, editable_height: nil, language: nil, **html_attributes, &block ) validate_editor_input!(initial_data, block) context = ckeditor5_context_or_fallback(preset) preset = Engine.find_preset!(preset || context[:preset] || :default) config = build_editor_config(preset, config, extra_config, initial_data) type ||= preset.type # Add some fallbacks config[:licenseKey] ||= context[:license_key] config[:language] = { ui: language } if language editor_props = Editor::Props.new( type, config, bundle: context[:bundle], watchdog: watchdog, editable_height: editable_height || preset.editable_height ) tag_attributes = html_attributes.merge(editor_props.to_attributes) tag.public_send(:'ckeditor-component', **tag_attributes, &block) end |
#ckeditor5_menubar(**kwargs) ⇒ Object
Creates a menubar component for decoupled editor.
129 130 131 |
# File 'lib/ckeditor5/rails/editor/helpers/editor_helpers.rb', line 129 def (**kwargs) ckeditor5_ui_part('menuBarView', **kwargs) end |
#ckeditor5_toolbar(**kwargs) ⇒ Object
Creates a toolbar component for decoupled editor.
119 120 121 |
# File 'lib/ckeditor5/rails/editor/helpers/editor_helpers.rb', line 119 def (**kwargs) ckeditor5_ui_part('toolbar', **kwargs) end |
#ckeditor5_ui_part(name, **kwargs, &block) ⇒ Object
Creates a UI part component for the editor (toolbar, menubar).
109 110 111 |
# File 'lib/ckeditor5/rails/editor/helpers/editor_helpers.rb', line 109 def ckeditor5_ui_part(name, **kwargs, &block) tag.public_send(:'ckeditor-ui-part-component', name: name, **kwargs, &block) end |