Class: CKEditor5::Rails::Presets::ToolbarGroupItem

Inherits:
ToolbarBuilder show all
Defined in:
lib/ckeditor5/rails/presets/toolbar_builder.rb

Overview

Builder class for configuring CKEditor5 toolbar groups. Allows creating named groups of toolbar items with optional labels and icons.

Examples:

Creating a text formatting group

group = ToolbarGroupItem.new(:text_formatting, [:bold, :italic], label: 'Text')
group.append(:underline)

Instance Attribute Summary collapse

Attributes inherited from ToolbarBuilder

#items

Instance Method Summary collapse

Methods inherited from ToolbarBuilder

#append, #break_line, #find_group, #group, #prepend, #remove, #remove_group, #separator

Constructor Details

#initialize(name, items = [], label: nil, icon: nil) ⇒ ToolbarGroupItem

Initialize a new toolbar group item.

Examples:

Create a new toolbar group

ToolbarGroupItem.new(:text, [:bold, :italic], label: 'Text formatting')

Parameters:

  • name (Symbol)

    Name of the toolbar group

  • items (Array<Symbol>, ToolbarBuilder) (defaults to: [])

    Items to be included in the group

  • label (String, nil) (defaults to: nil)

    Optional label for the group

  • icon (String, nil) (defaults to: nil)

    Optional icon for the group



177
178
179
180
181
182
# File 'lib/ckeditor5/rails/presets/toolbar_builder.rb', line 177

def initialize(name, items = [], label: nil, icon: nil)
  super(items)
  @name = name
  @label = label
  @icon = icon
end

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



167
168
169
# File 'lib/ckeditor5/rails/presets/toolbar_builder.rb', line 167

def icon
  @icon
end

#labelObject (readonly)

Returns the value of attribute label.



167
168
169
# File 'lib/ckeditor5/rails/presets/toolbar_builder.rb', line 167

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



167
168
169
# File 'lib/ckeditor5/rails/presets/toolbar_builder.rb', line 167

def name
  @name
end