class CKEditor5::Rails::Editor::Props

def self.valid_editor_type?(type)

def self.valid_editor_type?(type)
  EDITOR_TYPES.key?(type)
end

def initialize(

def initialize(
  type, config,
  bundle: nil,
  watchdog: true,
  editable_height: nil
)
  raise ArgumentError, "Invalid editor type: #{type}" unless Props.valid_editor_type?(type)
  @bundle = bundle
  @watchdog = watchdog
  @type = type
  @config = config
  @editable_height = EditableHeightNormalizer.new(type).normalize(editable_height)
end

def serialize_config

def serialize_config
  config
    .except(:plugins)
    .to_json
end

def serialize_plugins

def serialize_plugins
  (config[:plugins] || []).map { |plugin| PropsBasePlugin.normalize(plugin).to_h }.to_json
end

def serialized_attributes

def serialized_attributes
  {
    bundle: bundle.to_json,
    plugins: serialize_plugins,
    config: serialize_config,
    watchdog: watchdog
  }
    .merge(editable_height ? { 'editable-height' => editable_height } : {})
end

def to_attributes

def to_attributes
  {
    type: EDITOR_TYPES[@type],
    **serialized_attributes
  }
end