Class: CKEditor5::Rails::Editor::Props
- Inherits:
-
Object
- Object
- CKEditor5::Rails::Editor::Props
- Defined in:
- lib/ckeditor5/rails/editor/props.rb
Constant Summary collapse
- EDITOR_TYPES =
{ classic: 'ClassicEditor', inline: 'InlineEditor', balloon: 'BalloonEditor', decoupled: 'DecoupledEditor', multiroot: 'MultiRootEditor' }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller_context, type, config, watchdog: true, editable_height: nil, language: nil) ⇒ Props
constructor
A new instance of Props.
- #to_attributes ⇒ Object
Constructor Details
#initialize(controller_context, type, config, watchdog: true, editable_height: nil, language: nil) ⇒ Props
Returns a new instance of Props.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ckeditor5/rails/editor/props.rb', line 16 def initialize( controller_context, type, config, watchdog: true, editable_height: nil, language: nil ) raise ArgumentError, "Invalid editor type: #{type}" unless Props.valid_editor_type?(type) @controller_context = controller_context @watchdog = watchdog @type = type @config = config @language = language @editable_height = EditableHeightNormalizer.new(type).normalize(editable_height) end |
Class Method Details
.valid_editor_type?(type) ⇒ Boolean
37 38 39 |
# File 'lib/ckeditor5/rails/editor/props.rb', line 37 def self.valid_editor_type?(type) EDITOR_TYPES.key?(type) end |
Instance Method Details
#to_attributes ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ckeditor5/rails/editor/props.rb', line 30 def to_attributes { type: EDITOR_TYPES[@type], **serialized_attributes } end |